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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Hide access to the VB IDE? VB Should not open

Status
Not open for further replies.

nimo

Programmer
Apr 26, 2002
20
DE
HI all

I have VBA Macro running behind Excel..now, How do I Hide access to the VB IDE? VB Should not open even if someone presses ctrl-F11 .......the IDE should be totally hidden..how DO i do that? Also, how can I check whether Excel is already running before I use CreateObject("Excel.Application") ? And If Excel is already running, how DO I get an instance of that Excel? Using Get Object?

Thanx
 
nimo,

Instead of preventing access to the VBE, why not simply password protect (Lock) your VBA project for viewing??

You can use GetObject and trap/test for the error that will occur if an instance of the object (Excel, in this case) doesn't exist. Hmmm. If you are running this in Excel, you already know an instance exists. [ponder]


Regards,
Mike
 
I agree with Mike that unless it's absolutely necessary to prevent access to VBE, it's better to just protect your project. You can prevent access with approaches like:

application.OnKey "%{F11}",""
disables Alt-F11
application.CommandBars(1).controls("Tools").controls("Macro").controls("Visual Basic Editor").visible=false
removes entry from menu. you could also use .enabled=false to gray it out.

Even after this, the user can still get to VBE by choosing "Macros", then hitting the "Edit" button. You'd have to prevent access to the "Macros" menu item as well, which is getting kind of drastic...

Rob
[flowerface]
 
"Even after this, the user can still get to VBE by choosing "Macros", then hitting the "Edit" button. You'd have to prevent access to the "Macros" menu item as well, which is getting kind of drastic..."....can you Disable this Edit Button also?

 
So, Mike........how do I check it? got any IDEA?
 
So, Mike........how do I check it? got any IDEA? :)
 
You can't disable the edit button, as far as I know - you'd have to disable the macros... menu item.
Rob
[flowerface]
 
"you'd have to disable the macros... menu item"...which Menu item, like how do I disable the MAcros from the Excel or VBA? Where?... another question , If I disable the MACROs, then the Macros will not work , or?
 
nimo,

If you lock your project for viewing with a password, the user cannot edit the macro or view it in the VBE. The Edit button will be grayed even though the macro name is displayed and can be run. If you don't want it to show in the Macros dialog, declare it using the Private keyword.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top