xlAutoOpen failure

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

Guest

Dear all,

I have a snippet of code which keeps falling over on the Auto Open macro
part - can someone pls help? (I've cut out the non-relevant stuff below). n
is an integer which just loops through an array of workbooks.

FYI, normally the sheets are hidden for security reasons, but the AutoOpen
unhides the sheets and unprotects them.

---------
With appXL.Application

.Visible = True

.Workbooks.Open Filename:=Path & wb(n) & ".xls", UpdateLinks:=0
.ActiveWorkbook.RunAutoMacros xlAutoOpen
.ActiveWorkbook.sheets("data").select

End With
---------



Thanks
Phil
 
What does "falling over" mean? Are you getting an error message? If so,
what's the error? If you're not getting an error message, what are the
symptoms of what you're experiencing?
 
The workbook does have a macro, in a general module, named Auto_Open? That's
what you're telling it to run.

You might get better answers in Excel.Programming, if you haven't already
tried.

You might try putting a "Do Events" between Workbooks.Open and
RunAutoMacros. (Make sure you've given the workbook a chance to load).

Check out http://support.microsoft.com/kb/157308/en-us
I know it refers to XL 97, but there's no indication that the issue (calling
RunAutoMacros only works the 1st time from a given procedure) was ever
addressed. Since you seem to be using an index number & loop to open
workbooks, this might be relevant?

Note that in the same MSKB article they mention (as workaround) an
*alternative* method of how to run a "Auto" macro:
Application.Run ActiveWorkbook.FullName & "!Auto_Open"

HTH & Good Luck
 
Back
Top