Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data to Excel Peledon Excel Worksheet Functions 6 July 26th 09 05:12 PM
Exporting data to Excel Varne Excel Discussion (Misc queries) 1 September 24th 07 07:55 PM
Exporting Data from Excel Volker Jahn Excel Programming 0 January 13th 04 04:20 PM
Save, Save As, Print Grayed Out when instance created via VBA/VB6 Jake Marx[_2_] Excel Programming 0 September 22nd 03 10:16 PM
Save, Save As, Print Grayed Out when instance created via VBA/VB6 jaf Excel Programming 0 September 22nd 03 09:23 PM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"