Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How to disable Macros in VBA code

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default How to disable Macros in VBA code

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





"RoHiT" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How to disable Macros in VBA code

How do I set the Macro Security to Low through VBA code.

"Mangesh Yadav" wrote:

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





"RoHiT" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default How to disable Macros in VBA code

I doubt that's possible, otherwise the whole issue of having security will
be unjustified.

Mangesh



"RoHiT" wrote in message
...
How do I set the Macro Security to Low through VBA code.

"Mangesh Yadav" wrote:

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





"RoHiT" wrote in message
...
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default How to disable Macros in VBA code

HI
Use :
Application.enableEvents=false
open the WB
Application.enableEvents=true
This way, any associate events will not be fired.
Regards
Jean-Yves

"RoHiT" wrote in message
...
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





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
how do i disable macros? whatzzup Excel Discussion (Misc queries) 1 March 14th 06 01:51 PM
Disable macros Otto Moehrbach[_6_] Excel Programming 0 November 18th 04 03:49 PM
Disable/Enable Macros through code ibeetb Excel Programming 3 December 7th 03 05:24 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM
en-/disable macros pop-up James[_10_] Excel Programming 1 July 22nd 03 05:55 PM


All times are GMT +1. The time now is 05:26 PM.

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

About Us

"It's about Microsoft Excel"