Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open w/o enabling Macros???!!! - Possible??? 2

Status
Not open for further replies.
Hey Geoff,

Any news from your MVP's?



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Nope - doesn't seem like they're interested

Rgds, Geoff
[blue]Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?[/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 


I still have to disagree about there being a security issue.

The Virus Warning is there to tell you a new workbook that you have received has got macros in it so could easily mess your computer/files up.

If you do not trust the source of this workbook you would not enable macros so would not risk infecting other files, etc.

If you create your own procedure there does not need to be this test, as you are not going to program a virus and run it on your own machine, nor are you going to programmatically open workbooks you don't trust.



 
Oh I hope this isn't a dumb question...but I have to ask

Does this have anything to do with un-updated MS security patches, etc.?
 
Sorry DrBowes but I'm on Mike's side here. Macro virus security is not only there to help stop virii starting in the 1st place but also to stop them propagating and causing more widespread damage. '97 on NT certainly prompted when opening a workbook with macros via code and also DIDN'T run any auto_open macros unless prompted to do so

Rgds, Geoff
[blue]Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?[/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 

I see your point that once a virus gets started it can run amok, but it could still infect all the workbooks that don't already contain code, and add code to them too. In fact once a rebellious workbook is allowed to do what it wants pausing to ask about whether to enable macros in existing workbooks is going to do little to slow it down. More likely it would target other things like the registry or just delete files anyway.

I'm sure I had Excel 97 previously and opened workbooks programmatically without being asked to enable their macros, but I don't have access to it anymore so cannot be sure....

I have never seen virus protection as any more than a warning when I open new workbooks I have received, and for this it serves as a useful protection. If I am emailed a spreadsheet from an unknown source I would open with macros disabled first and check it over to make sure it won't do anything untoward. If the VBA code is protected I would not proceed unless I trusted the source.

 
Hey, Mike

I think you deserve a star (at least) for uncovering this potentially harmful "bug"!

Sue...

So here ya go!
 
Thanks Sue,

And I am willing to give 10 stars (not possible unfortunately) to the person who uncovers the meaning behind all of this!!!



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
How can this work: application.displayalerts ???
Your are asks to enable macros before any macros are run, so if you place "application.displayalerts" in a macro it is too late, no???
 
Hi Mike,
it seems that it is possible to disable macros only since xp version, with new AutomationSecurity property. There you can use:
Application.AutomationSecurity = msoAutomationSecurityForceDisable
(other options: msoAutomationSecurityByUI, msoAutomationSecurityLow - the default).

combo
 
Hi again,
There is an indirect possibility to block auto macros in excel 2000 (and earlier version) while opening workbook by code. It can be done via EnableEvents property (acts on all workbooks). It is also possible to switch design mode if the "design mode" button is available in any visible or hidden toolbar (ID=1605 in excel 2000) The combination of both:

[tt]Dim x As Workbook
Dim cbc As CommandBarControl
' disable event macros
Application.EnableEvents = False
Set x = Workbooks.Open("Path & Filename")
x.Activate
Application.EnableEvents = True
' find & execute "Design mode" button
Set cbc = CommandBars.FindControl(Type:=msoControlButton, ID:=1605, Visible:=False)
cbc.Execute
Set cbc = Nothing[/tt]

combo
 
where do i put this code into my application to disable the question of enabling or not?
 
You can't if you are just opening ONE workbook - this "feature" only works if you use 1 workbook to open another programatically

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
In the way of related problems. When you hold down the shift key on a document or workbook when you open it, the macros should not run. Recently, I have found that this approach did not work and the macros ran in the workbook. This sounds like a related problem. It was on a network profile when I tested it and it was an Excel workbook.
Regards, RBVBA.
 
For the record, I am running Excel 97 / Windows NT and workbooks.open works as described here - opens w/o prompting to activate macros.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top