Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Workbooks Open Statement

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
--
C Ward
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Workbooks Open Statement

Try disabling the events....

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

If this post helps click Yes
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Workbooks Open Statement

I don't think Workbook open run the Workbook Open Events or Auto run events.

"christopher ward" wrote:

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
--
C Ward

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Workbooks Open Statement

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
--
C Ward


"Jacob Skaria" wrote:

Try disabling the events....

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

If this post helps click Yes
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Workbooks Open Statement

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
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward


"Jacob Skaria" wrote:

Try disabling the events....

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

If this post helps click Yes
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Workbooks Open Statement

Many thanks
--
C Ward


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward


"Jacob Skaria" wrote:

Try disabling the events....

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

If this post helps click Yes
---------------
Jacob Skaria


"christopher ward" wrote:

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
--
C Ward

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel2007; workbooks.count is not counting all open workbooks greg.campeau Excel Programming 2 August 2nd 08 08:37 PM
VBA Excel.WorkBooks.Open can't open an XML format xls file giantdino Excel Programming 2 August 14th 07 03:12 PM
When I open Excel, workbooks open automatically. How can I stop t Rhealbird Excel Discussion (Misc queries) 2 February 23rd 06 10:08 AM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. san Excel Programming 1 January 3rd 06 03:22 AM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM


All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"