View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Worksheets not visible in Excel XP

Correction...

Set xlApp = New.Excel.Application should be
Set xlApp = New Excel.Application ' (no dot)

Jim Cone



"Jim Cone" wrote in message
...
John,

First of all if there is no existing Excel application running then
your code will fail at the GetObject line.
One way to get around that is to create a new instance of the App...
Set xlApp = New.Excel.Application
The new app will not be visible, but if you need to see it then..
xlApp.Visible = True

However, to answer you questions try...

Set wkb = xlApp.Workbooks.Add
Set wks = wkb.Worksheets(1)

I don't believe you need to specify the number of sheets in the
new app, as Excel will not create a workbook without at least one
sheet in it.

Also, I would set the worksheet and workbook objects to nothing
before quitting the application.

Regards,
Jim Cone
San Francisco, USA