View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default personal.xls doesn't launch in COM

Ps. My personal.xl* is .xla. I forgot to change the extension back to .xls in
the second example.

Dave Peterson wrote:

This worked when I tested it using MSWord's VBA:

Dim xlApp As Variant
Dim xlsheet As Variant

Set xlApp = CreateObject("Excel.Application")
xlApp.StatusBar = "Creating WorkSheet. Please be patient..."
xlApp.Visible = True
xlApp.workbooks.Open FileName:=xlApp.StartupPath & "\" & "personal.xls"
xlApp.workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.workbooks(1).Worksheets(1)

========
If your personal.xls workbook has an auto_open procedure that you need to run:

Dim xlApp As Variant
Dim xlsheet As Variant
Dim xlWkbk As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.StatusBar = "Creating WorkSheet. Please be patient..."
xlApp.Visible = True
Set xlWkbk = xlApp.workbooks.Open _
(FileName:=xlApp.StartupPath & "\" & "personal.xla")
xlWkbk.RunAutoMacro 1 'xlautoopen

xlApp.workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.workbooks(1).Worksheets(1)

wrote:

I've written some could that launches excel and populates a new
worksheet using COM, Unfortunately, when I launch Excel through my COM
script, it does not open my hidded Personal.xls workbook. I need this
to open for the user so they can use macros that are stored there.

Any ideas??

TIA

Here's a snippet of my code:

Dim xlApp As Variant
Dim xlsheet As Variant

Set xlApp = CreateObject("Excel.Application")
xlApp.StatusBar = "Creating WorkSheet. Please be patient..."
xlApp.Visible = True
xlApp.Workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.Workbooks(1).Worksheets(1)


--

Dave Peterson


--

Dave Peterson