How to disable Macros in VBA code

G

Guest

In my code, I create an Excel Application object during runtime. Using the
same, I open an workbook which has macros attached to its Workbook_Open
event. Is there a way, I could disable the execution of the macros associated
with the Workbook.

Also, in case I try to open a readonly workbook through code, it asks for
confirmation whether the workbook should be opened as read only. Is there a
way, I could skip this confirmation.


regards

RoHiT
 
M

Mangesh Yadav

just a guess, try:

Application.DisplayAlerts = False, for the second query, and it should work
for the first if your security setting is set to medium beforehand. If it is
low, the macros will be enabled directly without promting.

at the start.


Mangesh
 

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

Top