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.

Bowers74

MIS
Nov 20, 2002
1,085
0
0
US
Someone PLEASE prove me wrong!

When I run the following procedure and set wb to a Workbook that contains macros, it opens just the Workbook just fine and I don't have to Enable Macros. The Macros run fine and do every thing they are supposed to do. My security settings are set to Medium (i.e. I should be asked to Enable Macros!), but this is still working. My PC at work is running Windows 2000 Pro and Office 2000 Premium.

Code:
Sub OpenWorkbook()
Dim wb As String
wb = "Workbook_You_Want_To_Open_With_Path_&_File_Extention"
Application.Workbooks.Open (wb)
End Sub

Have I found the "Holy Grail" that allows us to open workbooks w/o Macro Confirmation? [wavey]

Or is it because I haven't had my coffee this morning? [morning]


What's Up?



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
you got application.displayalerts off Mike ??

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
 
a useful tip if you dont want to click every time you open a workbook on the "Enable Macros" Button:

go in the directory C:\Program Files\Microsoft Office\Office

click on the application SERFCERT.EXE, this gives you the possibility to make a personal digital certificate.

After the creation of the certificate in the VBA Window go on Tools -> Digital Signature and select the signature you made.
Now your macros are digitally signed. Save your worksheet and open again. Now you see a different window not the same window with enable macros. check the box "Always trust..." and "OK".

See now: all the files digitally signed by you are opened in automatic by everyone who trusts your digital signature. If someone (better anyone who uses a differet win login)modifies a macro written by you, Excel removes the digital signature (so it's also a way to control if someone modifies your macros!!)
Note: all the oter excel files not digitally signed opens always with the boring "Enable macro" button!

Hope this helps!

A
 
this should be selfcert.exe

click on the application SERFCERT.EXE, this gives you the possibility to make a personal digital certificate.


Thanks Rob.[yoda]
 
I don't have any person digital certificates on any of the 20 Worbooks I've tested this on (all contain Macros). I don't have Application.DisplayAlerts anywhere in the code (or in any module in the workbook).

Try it out and see if it works for you.



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Sorry for the typo of the name of the application. (-:

I tried and it's the same to me. It opens workbook with macros without any alert.

Really strange
 
But Really Cool (and Dangerous???)



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Just tried it on xp - works AND runs the workbook_open event which I was lead to believe didn't happen when a wb was opened thru code.......puzzlin'.......

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
 
Can this be used??? Yes!

Is this helpful??? Doubtful??

But the question remains, what can we do about this?



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
OK,

I just changed my Macro security settings to HIGH and I opened a NEW (unsigned, non DisplayAlerts = False, containing Macros in the Workbook_Open event) workbook using the code above, and guess what?

IT OPENED!!! AND RAN THE MACRO IN THE WORKBOOK_OPEN EVENT!!!!! (WITHOUT ASKING TO ENABLE/DISABLE MACROS)!!!

Does any one know why???? Is this a possible security problem???



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Bowers74 says:

Maybe it is a Windows issue.

.....maybe it is an Excel Bug.....[sadeyes]
 
OK, I'll drop it.



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
I sent this off to one of my excel developers lists but havn't had anything back yet - there's at least 3 excel MVPs on that list - all of whom were involved in beta testing XP so if anyone knows, they should

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 guess the logic is that once you have trusted the workbook with the original macro (not opened with code), that it isn't necessary to ask about any future workbooks opened by macros in that workbook because the "trusted" workbook wouldn't open any rogue workbooks anyway.

The workbook open event would always run when the workbook is open by code unless events are disabled.

Does anybody know why Access doesn't have any virus warning? Incidentally you can open an Excel workbook from Access without any virus warning too (and unlike Excel without any warning on the original Access database).
 
DrBowes:

I never even saved the workbook that contained the OpenWorkbook() procedure, it was a newly created workbook with a newly created module containing a newly created procedure. (i.e. I never enabled macros for that workbook).

I am excited about this (but also a bit confused!)

I guess we will have to wait for Geoff's gurus (MVP's) to answer back.



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Well it helps me out since I am working on a "reirement-length" project that I am continually opening and closing. I can bypass the annoying dialog box with just that one spreadsheet. So I love it but can sure see the potential problems! Must be something Microsoft overlooked and needs to know about...

Sue...
 
Hi blue,

You could also bypass the Macro Warning for Workbooks that you use often by using the Digital Signature creator that terzaghi suggested.

But I'm glad someone thinks this is helpful! [wavey]



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
I think that by entering the VB editor and creating a new macro, you are by proxy approving the enabling of macros in any future workbook that you may open with that instance of Excel. I am not sure of the usefulness of this, because in order to bypass the security prompt on the 2nd workbook, a user would have to either enable the macros on the 1st workbook (as suggested above by DrBowes) or be savvy enough to create a new macro in a blank workbook to open the target workbook - a much more time consuming process than simply clicking the "enable" button on the prompt.

- just my 2 cents worth

Glenn
 
I believe that the entire point of this discussion is slowly turning around and going in the wrong direction.

I am not trying to FIND a way to open a workbook w/o having to enable macros. I was simply trying to point out that I could open a workbook that contains macros with the procedure above and that this could be potentially dangerous.

In a way, it could be helpful, for some. If you have a type of Directory Workbook, that contains a list of all of the workbooks you work with often, you could select a workbook in the list and then use the cell's value as the varible. It is doubtful that anyone would want to do this, but it is possible, and in certain situations, possibly helpful.

So the discussion should be: Doesn't it kind of defeat the purpose of having Macro Protection for individual workbooks if the protection logic is so easy to bypass?



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Absolutely it does - this IMHO is a very bad thing. Lets say someone sends an infected workbook which has code that simply searches all directories and opens and infects every otrher excel file it finds.....not good. That is what the macro virus protection is there for and this seems to make it completely redundant

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top