Excel VBA - Disabling Macros on a Worksheet

  • Thread starter Thread starter nanasto
  • Start date Start date
N

nanasto

I am using the contents of the excel file "A", to update the data of th
excel file "B".

The VBA code in excel "A" is working fine with excel 2000 but I receiv
an error message with Excel 2003 (as well as Excel XP).

I concluded that the problem is solved ahen I open excel "B" manuall
with macros disabled.

Do you know any way that I can do that using VBA code in Excel "A"
 
Hi Nanasto,
I concluded that the problem is solved ahen I open excel "B" manually
with macros disabled.

Do you know any way that I can do that using VBA code in Excel "A" ?

Just before the code line that opens the file, include:

Application.EnableEvents=False

Immediately after the opening code, make sure you add:

Application.EnableEvents=True

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 
I don't believe you can disable macros in versions earlier than 2002, but
you can prevent an Workbook_Open event from firing or other Excel events
from firing by disabling events

Application.EnableEvents = False
Workbooks.Open B.xls
' processing code

Application.EnableEvents = True
 
Thanks for your replies but I am afraid that this solution does not wor
with my worksheets.. I still receive an error message saying :

Run Time Error '9"
Subscript out of range

If there is not any way that I can disable macros in excel "B" usin
code in excel "A", maybe someone knows if I can enter design mode usin
vba code ?
 
Hi Nanasto,
I still receive an error message saying :

Run Time Error '9"
Subscript out of range

Maybe you should explain a bit more and add the offending code here,
with an explanation as to what it should do?

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top