Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Prevent others from running my macros

Hi all,

Very often I have to send my Excel files (with macros) to others. Is there
any simple way of preventing third parties from running the macros in those
files? Thanks.

Frederick Chow
Hong Kong.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Prevent others from running my macros

The simple way would be to require a password to run the macro:

Public Sub MyMacro()
Const sPWORD As String = "drowssap"
Dim vResponse As Variant
Do
vResponse = Application.InputBox("Password: ", Type:=2)
If vResponse = False Then Exit Sub 'User Cancelled
Loop Until vResponse = sPWORD
'your code here
End Sub

Then protecting your code (Tools/Project Properties in the VBE).

However, that will not keep anyone with the gumption to find these
newsgroups from finding a way to see/run your macros:

http://www.mcgimpsey.com/excel/fileandvbapwords.html

A more secure way is to put your code in a separate add-in so that it's
never sent to the others.



In article ,
"Frederick Chow" wrote:

Hi all,

Very often I have to send my Excel files (with macros) to others. Is there
any simple way of preventing third parties from running the macros in those
files? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Prevent others from running my macros

Thanks a lot. A textbox asking for a password is a workable solution.

Frederick Chow
"JE McGimpsey" wrote in message
...
The simple way would be to require a password to run the macro:

Public Sub MyMacro()
Const sPWORD As String = "drowssap"
Dim vResponse As Variant
Do
vResponse = Application.InputBox("Password: ", Type:=2)
If vResponse = False Then Exit Sub 'User Cancelled
Loop Until vResponse = sPWORD
'your code here
End Sub

Then protecting your code (Tools/Project Properties in the VBE).

However, that will not keep anyone with the gumption to find these
newsgroups from finding a way to see/run your macros:

http://www.mcgimpsey.com/excel/fileandvbapwords.html

A more secure way is to put your code in a separate add-in so that it's
never sent to the others.



In article ,
"Frederick Chow" wrote:

Hi all,

Very often I have to send my Excel files (with macros) to others. Is
there
any simple way of preventing third parties from running the macros in
those
files? Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Excel crash when running rauxalacch[_2_] Excel Programming 1 November 18th 05 06:07 AM
Prevent A Macro From Running If SpreadSheet is Filtered carl Excel Worksheet Functions 1 June 22nd 05 04:04 PM
How to prevent routine from running on certain sheets Gary Paris[_3_] Excel Programming 2 February 8th 05 03:28 PM
Prevent end users from manually running or recording macros Township of East Hanover Excel Programming 0 June 14th 04 06:03 PM
Prevent users from running macros Alan Hutchins Excel Programming 7 June 2nd 04 05:12 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"