Jump to content
Xtreme .Net Talk

dylanmendes

Members
  • Posts

    11
  • Joined

  • Last visited

dylanmendes's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks, Mark.. that's pretty handy!
  2. Well, this article sheds more light though it doesn't provide a feasible solution..
  3. Code snippet... Hi.. thanks for your prompt response. Here it is: Private Sub Command1_Click() Dim appWord As New Word.Application appWord.Visible = True appWord.Documents.Add ("C:\XYZ\abc.dot") End Sub
  4. Dear VB brains, I'm attempting to open a template (.dot file) via my VB application. The intention is to open a new document based on the template as opposed to the template itself i.e. we're trying to reproduce the "file -> NEW" menu functionality! .. and all of this works very well.. NOT!!!! The document opens as expected but when I attempt to close the session, I get a message telling me that the "normal.dot" file is in use by another application. I understand that this "normal.dot" file is something called a Global template. Our application does not explictly open this file. How can I avoid the above message at the time of closing the application? Thanks, Dylan
  5. Mark, that's awesome! I tried the workaround and it works. I mean, I don't think popping up the Excel sheet is a big deal with the client and I'd like to stay away from the shell command. But I'd forgotten that I could just try and save it! Thank you so much for all your help! Thanks everyon!!!
  6. Mike and everyone, I tried running it with username="SYSTEM" under process model and it doesn't work - it's still invisible. I've also tried the Tools-->General--->Ignore other applications setting and it is unchecked, so that's fine too. Any more ideas.. anything??? - I'm in HUGE trouble :(
  7. Unfortunately, we're too far down the pike to change the setup right now. I will be trying stuff out with the client within a few hours. Will keep the thread posted. Cheers, Dylan
  8. Hi PD, The working set includes both Windows 2000 as well as XP. The PC with the problem is Windows XP. One difference between the working and the non-working ones is that the non-working PC does not have Admin rights. thanks for checking in.. Dylan
  9. Hiya- thanks for the prompt response and apologies for the poorly formatted code! I actually signed on to share with you an idea I had and Lo! i see your reply :) First let me answer your questions- 1) This is an ASP.NET application. But the webserver and the client are the same. 2) I'm not sure about this cause the client is in a different geography, but I will confirm this tomorrow. However, going by the way the app behaves on my computer - initially there are no instances; after the first run, the Excel.Application object is reused so there will be just one. 3) This has never worked on the PC in question. Now for the interesting part: I created two test projects that ONLY performed the simple task of opening an Excel application and making it visible on the click of a button. One of these applications was a Web app with ASP.NET and the other was a Windows Forms app in VB.NET. I found that the VB.NET app opens the Excel and makes it visible but the ASP.NET does not. I am led to believe that this has something to do with the ASP.NET user account! My suspicions are strengthened by the fact that this particular user has had issues with rights to folders etc. while the others have not. He is not an admin on his PC. What's the missing piece to have him see the application? Cheerio and thanks, Dylan
  10. Thanks to both of you for replying. I did try reinstalling Excel on his laptop but same error. I've now confirmed that both of us have the same Excel version. Regarding the disposal of COM components - is that an issue since I haven't gotten to the point of disposal yet? I don't understand why, without throwing an error, the application does not show up on just this one guy's computer! With everything seeming identical I might add. I'm not sure I understand your comment on Intrinsic references, Mark. I have pasted another method from my code. This combined with the earlier method really covers everything of interest on the Excel front. Do you think you could point out with an example what type of referencing I SHOULD be using. Appreciate your help! Private Sub InsertDataInExcel(ByRef wbookData As Excel.Workbook, ByVal dtableAnalysisData As DataTable) Try Dim row As Integer Dim col As Integer Dim rowCount As Integer Dim colCount As Integer Dim cell As String Dim rowcell As Integer Dim excelWorksheet As Excel.Worksheet = wbookData.Worksheets(1) excelWorksheet.Name = "Analysis Data" ' get count of rows and count of columns rowCount = dtableAnalysisData.Rows.Count() colCount = dtableAnalysisData.Columns.Count() ' add the column headings For col = 0 To colCount - 1 row = 1 cell = GetExcelColumn(col) & row.ToString excelWorksheet.Range(cell).Value = dtableAnalysisData.Columns(col).ColumnName 'excelWorksheet.Range(cell).ColumnWidth = grdFieldnetData.TableStyles(0).GridColumnStyles(col).Width / 4 Next ' now add the data elements For row = 0 To rowCount - 1 rowcell = row + 2 For col = 0 To colCount - 1 cell = GetExcelColumn(col) & rowcell.ToString excelWorksheet.Range(cell).Value = dtableAnalysisData.Rows(row)(col).ToString() Next Next 'Finally format the header row Dim rngHeader As Excel.Range rngHeader = excelWorksheet.Range("A1").EntireRow rngHeader.AutoFit() rngHeader.Columns.ColumnWidth = 25 rngHeader.Font.Bold = True 'rngHeader.Font.Color = grey Catch ex As RethrownException Throw ex End Try End Sub
  11. Hello all, My ASP.NET application attempts to export data into an Excel workbook using the following code: Dim excelFileRef As Excel.Application excelFileRef = New Excel.Application Dim wbookNew As Excel.Workbook wbookNew = excelFileRef.Workbooks.Add 'Save Instructions to Excel Workbook InsertStringInExcel(wbookNew, strInstructions) 'Write data to Excel Workbook InsertDataInExcel(wbookNew, dtableAnalysis) excelFileRef.Visible = True This code works fine on about 2/3 machines. However, when run on one of my client's machine, the Excel sheet does not open up. When I stepped through code here, it worked OK with no errors, except that the Excel application did not pop up when excelFileRef.Visible = True executed! Further, when I checked the processes in Tast manager, there was a new EXCEL.EXE process. What do I need to do to allow my client to see the Excel application?
×
×
  • Create New...