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

Not allowing users to run macros from Tools-Macros

Status
Not open for further replies.

gautammalkani

Technical User
Sep 29, 2003
51
US
Hi All

I have locked off my macros if the user goes to VB editor.

Is there a way to prevent the user from seeing the macro names when they go to Tools -> Macros?

Thanks for your help

Gautam
 
I believe only public subroutines show up as macros. You can convert your subroutines to functions and they won't show or you can do what Frederico says: Change your subroutines from public to private. Private subroutines do not show either. However if you have subroutines in one module that call subroutines in other modules, private won't do it for you (Scope). You'd have to place them all in one module. Try the Function approach. A function doesn't have to return anything. Also, memory fails me, but I believe you may have to change the syntax a little to call a function as oppose to calling a subroutine.


'This works and you can check out the macros list.
Sub main()
Call tst
Call tst2
Call tst3
End Sub

'by default function is public
Function tst()
x = 1
End Function

'by default subroutine is public
Sub tst2()
y = 2
End Sub

'a private subroutine
Private Sub tst3()
z=3
End Sub
 
Gautam,

See my first reply in thread707-651944 (about 2/3 of the way down the rather lengthy thread).


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top