PC Review


Reply
Thread Tools Rate Thread

Can I prevent a user from running a macro?

 
 
Michelle
Guest
Posts: n/a
 
      30th Nov 2008
I have a macro that I want to be able to call from other macros, but it is
important that it cannot be run by users.

I have tried making it Private, but then the other macros also can't call
it.

Is there a way around this?

Thanks

Michelle

 
Reply With Quote
 
 
 
 
Michelle
Guest
Posts: n/a
 
      30th Nov 2008
Bloomin' marvellous answer - I can't believe I've not come across this
before - Thank you

M

"royUK" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> If you place the private module in a separate module and use Option
> Private Module it will not show in the Macro list for that workbook.
>
>
> Code:
> --------------------
> Option Explicit
> Option Private Module
>
> Sub test()
> MsgBox "Hello World"
> End Sub
> --------------------
>
>
> Place the main code in another module
>
>
> Code:
> --------------------
> Option Explicit
>
> Sub main()
> test
> End Sub
> --------------------
>
>
> --
> royUK
>
> Hope that helps, RoyUK
> For tips & examples visit 'my web site' (http://www.excel-it.com/)
> ------------------------------------------------------------------------
> royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
> View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=35285
>


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      30th Nov 2008
You could even ask for a password...

Option Explicit
Sub MichelleOnly()
dim myStr as string

myStr = inputbox(prompt:="What's the password")

if mystr <> "ThisISToPSecRet" then
exit sub
end if

'rest of code
End sub

Michelle wrote:
>
> I have a macro that I want to be able to call from other macros, but it is
> important that it cannot be run by users.
>
> I have tried making it Private, but then the other macros also can't call
> it.
>
> Is there a way around this?
>
> Thanks
>
> Michelle


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent user from deleting a tab prevent running macro from menu joemeshuggah Microsoft Excel Programming 5 25th Feb 2010 10:58 PM
How do I prevent unintentionally running a Macro? =?Utf-8?B?VUFfSmVyZW15?= Microsoft Excel Programming 1 8th Sep 2006 10:51 PM
Prevent a user from running cmd.exe =?Utf-8?B?UG9wZXll?= Windows XP New Users 8 23rd Apr 2006 12:40 AM
Prevent A Macro From Running If SpreadSheet is Filtered =?Utf-8?B?Y2FybA==?= Microsoft Excel Worksheet Functions 1 22nd Jun 2005 04:04 PM
Prevent macro or code from running until a condition is met Richardson Microsoft Access Form Coding 3 4th May 2004 04:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 AM.