Workbooks Open Statement

  • Thread starter Thread starter christopher ward
  • Start date Start date
C

christopher ward

Dear Experts ,


I am using the following code in a loop to open a number of sheets in a
directory however I do not know if I can improve this line of code to deal
with sheets which have auto start macros - ideally I would like to ignoar the
auto start

Workbooks.Open Filename:=sPath & sFile, _
Password:="tiger", UpdateLinks:=0, WriteResPassword:="tiger"

If you can suggest how I can improve this please feel free and I thank you
advance , also if you think of an area my open statement does not process I
would be interested in your knowledge. As always kind regards

Chris W
 
Try disabling the events....

Application.EnableEvents = False
'Your code
Application.EnableEvents = True

If this post helps click Yes
 
Thanks Jacob I am hoping I have covered the events already as shown below

With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
.EnableEvents = False
End With
 
Hi Chris

Just try this.

Open a new workbook. Launch VBE alt+F11. Within Activeworkbook Open place a
msgbox. Save and close. Everytime when you open the workbook it should
display the messagebox (even open through code). Now from another workbook
module create a macro to open the same workbook with

Application.EnableEvents = False
Workbooks.Open <filename>
Application.EnableEvents = True

It should not initiate any events...the msgbox will not be displayed

If this post helps click Yes
 
Many thanks
--
C Ward


Jacob Skaria said:
Hi Chris

Just try this.

Open a new workbook. Launch VBE alt+F11. Within Activeworkbook Open place a
msgbox. Save and close. Everytime when you open the workbook it should
display the messagebox (even open through code). Now from another workbook
module create a macro to open the same workbook with

Application.EnableEvents = False
Workbooks.Open <filename>
Application.EnableEvents = True

It should not initiate any events...the msgbox will not be displayed

If this post helps click Yes
 
Back
Top