Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exporting data to new instance of excel - created but not visible?
Hi All, I am using the code below upon the click event of a command button in a userform to export a database to an new excel workbook. I want it to be a new instance of excel so that the user can Alt-Tab between the open system (controlled by userform 'menus') and the export. The code runs okay, but it seems to create a new instance of excel that is not visible in windows. I can see it from the process list and I can kill it from there, but I want the user to be able to see it and Alt-Tab between it and the original instance. I found a reference to something similar in this group from 2001 (Tom Ogilvy) so I removed my WITH constructs but no improvement (see commented out WITHs in the code below): http://groups.google.co.nz/groups?hl...%40tkmsftngp03 Any help is much appreciated, Alan. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Private Sub cmdExportDatabase_Click() Set newxlApp = New Excel.Application Set newBook = newxlApp.Workbooks.Add newBookName = ("Export as at " & Format(CDate(Now()), "HHMM DDDD D MMM YYYY")) ' With newBook newBook.Title = newBookName newBook.Subject = "Inventory" newBook.SaveAs Filename:=newBookName ' End With Application.Workbooks("Inventory System.xls").Worksheets("Database").Activate Cells.Select Selection.Copy ' With newBook newBook.Worksheets("Sheet1").Activate newBook.Worksheets("Sheet1").Range("A1").Select Selection.PasteSpecial newBook.Worksheets("Sheet1").Cells.Validation.Dele te Range("A2").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.AutoFilter Range("A1").Copy Range("A1") Range("A1").Select ' End With Application.Workbooks("Inventory System.xls").Worksheets("Active").Activate MsgBox ("Database exported") End Sub +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exporting data to new instance of excel - created but not visible?
Set newxlApp = New Excel.Application
newxlApp.Visible = True -- Regards, Tom Ogilvy "Alan" wrote in message ... Hi All, I am using the code below upon the click event of a command button in a userform to export a database to an new excel workbook. I want it to be a new instance of excel so that the user can Alt-Tab between the open system (controlled by userform 'menus') and the export. The code runs okay, but it seems to create a new instance of excel that is not visible in windows. I can see it from the process list and I can kill it from there, but I want the user to be able to see it and Alt-Tab between it and the original instance. I found a reference to something similar in this group from 2001 (Tom Ogilvy) so I removed my WITH constructs but no improvement (see commented out WITHs in the code below): http://groups.google.co.nz/groups?hl...%40tkmsftngp03 Any help is much appreciated, Alan. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Private Sub cmdExportDatabase_Click() Set newxlApp = New Excel.Application Set newBook = newxlApp.Workbooks.Add newBookName = ("Export as at " & Format(CDate(Now()), "HHMM DDDD D MMM YYYY")) ' With newBook newBook.Title = newBookName newBook.Subject = "Inventory" newBook.SaveAs Filename:=newBookName ' End With Application.Workbooks("Inventory System.xls").Worksheets("Database").Activate Cells.Select Selection.Copy ' With newBook newBook.Worksheets("Sheet1").Activate newBook.Worksheets("Sheet1").Range("A1").Select Selection.PasteSpecial newBook.Worksheets("Sheet1").Cells.Validation.Dele te Range("A2").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.AutoFilter Range("A1").Copy Range("A1") Range("A1").Select ' End With Application.Workbooks("Inventory System.xls").Worksheets("Active").Activate MsgBox ("Database exported") End Sub +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exporting data to new instance of excel - created but not visible?
"Tom Ogilvy" wrote in message ... Set newxlApp = New Excel.Application newxlApp.Visible = True Doh! Thanks Tom. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exporting data to new instance of excel - created but not visible?
newXLapp.visible=true should do the trick
keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Alan" wrote: Hi All, The code runs okay, but it seems to create a new instance of excel that is not visible in windows. I can see it from the process list and I can kill it from there, but I want the user to be able to see it and Alt-Tab between it and the original instance. Any help is much appreciated, Alan. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Private Sub cmdExportDatabase_Click() Set newxlApp = New Excel.Application End Sub +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exporting data to new instance of excel - created but not visible?
"keepITcool" wrote in message
... newXLapp.visible=true should do the trick keepITcool Thanks - don't I feel a fool! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exporting data to Excel | Excel Worksheet Functions | |||
Exporting data to Excel | Excel Discussion (Misc queries) | |||
Exporting Data from Excel | Excel Programming | |||
Save, Save As, Print Grayed Out when instance created via VBA/VB6 | Excel Programming | |||
Save, Save As, Print Grayed Out when instance created via VBA/VB6 | Excel Programming |