Create a new Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
I have the following codes and I try to add a new worksheet for a new
Excel app.:

Is there anything wrong with the codes? I could not have the application
open and it looks like a very quick flash on the screen and the app.
disappears, please help.
Thanks
Ed

Dim obj As Object
Set obj = CreateObject("Excel.sheet") ' should it be "Excel.Application"?
obj.Worksheets.Add
obj.Application.Parent.Visible = True
obj.Parent.Windows(1).Visible = True
 
Ed said:
hi,
I have the following codes and I try to add a new worksheet for a new
Excel app.:

Is there anything wrong with the codes? I could not have the application
open and it looks like a very quick flash on the screen and the app.
disappears, please help.
Dim obj As Object
Set obj = CreateObject("Excel.sheet") ' should it be "Excel.Application"?

Yes, try:

Dim obj As Object
Dim xlsht As Object
Set obj = CreateObject("Excel.Application")
Set xlsht = CreateObject("Excel.Sheet")

obj.Visible = True
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top