Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 24
Default Password protected macro

Is there a way to password protect a macro.

The workbook it will run in is already password protected but I don't want
other users (they open it in Read Only with on the Administrators opening it
full mode) inadvertantly clicking the macro although it won't cause any
problem if they do just will stop them from viewing the workbook for about 5
mins dependant on the number of worksheets the macro has to update.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Password protected macro


You can put a line of code or two just before your main code, something
like:

If environ("username")< "Simon" Or
environ("username")< "Bob" Then Exit Sub

Now if the windows logon name is not equal to Simon or Bob the sub will
exit everytime!

Beverly Darvill;263256 Wrote:
Is there a way to password protect a macro.

The workbook it will run in is already password protected but I don't
want
other users (they open it in Read Only with on the Administrators
opening it
full mode) inadvertantly clicking the macro although it won't cause any
problem if they do just will stop them from viewing the workbook for
about 5
mins dependant on the number of worksheets the macro has to update.

Thanks



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=73487

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 236
Default Password protected macro

a QUICK GOOGLE WILL BRING YOU TO...
http://www.ifsconnect.com/
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Simon Lloyd" wrote:


You can put a line of code or two just before your main code, something
like:

If environ("username")< "Simon" Or
environ("username")< "Bob" Then Exit Sub

Now if the windows logon name is not equal to Simon or Bob the sub will
exit everytime!

Beverly Darvill;263256 Wrote:
Is there a way to password protect a macro.

The workbook it will run in is already password protected but I don't
want
other users (they open it in Read Only with on the Administrators
opening it
full mode) inadvertantly clicking the macro although it won't cause any
problem if they do just will stop them from viewing the workbook for
about 5
mins dependant on the number of worksheets the macro has to update.

Thanks



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=73487


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 236
Default Password protected macro

Wrong post...AND sorry for SHOUTING :O<
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Gary Brown" wrote:

a QUICK GOOGLE WILL BRING YOU TO...
http://www.ifsconnect.com/
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Simon Lloyd" wrote:


You can put a line of code or two just before your main code, something
like:

If environ("username")< "Simon" Or
environ("username")< "Bob" Then Exit Sub

Now if the windows logon name is not equal to Simon or Bob the sub will
exit everytime!

Beverly Darvill;263256 Wrote:
Is there a way to password protect a macro.

The workbook it will run in is already password protected but I don't
want
other users (they open it in Read Only with on the Administrators
opening it
full mode) inadvertantly clicking the macro although it won't cause any
problem if they do just will stop them from viewing the workbook for
about 5
mins dependant on the number of worksheets the macro has to update.

Thanks



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=73487


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Password protected macro



If environ("username")< "Simon" Or
environ("username")< "Bob" Then Exit Sub



You need an AND not an OR.

If Environ("username") < "Simon" And _
Environ("username") < "Bob" Then Exit Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 10 Mar 2009 16:04:41 +0000, Simon Lloyd
wrote:


You can put a line of code or two just before your main code, something
like:

If environ("username")< "Simon" Or
environ("username")< "Bob" Then Exit Sub

Now if the windows logon name is not equal to Simon or Bob the sub will
exit everytime!

Beverly Darvill;263256 Wrote:
Is there a way to password protect a macro.

The workbook it will run in is already password protected but I don't
want
other users (they open it in Read Only with on the Administrators
opening it
full mode) inadvertantly clicking the macro although it won't cause any
problem if they do just will stop them from viewing the workbook for
about 5
mins dependant on the number of worksheets the macro has to update.

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
Excel macro to open a password protected workbook Stephen C Excel Discussion (Misc queries) 8 December 1st 08 05:36 AM
password protected macro mcphc Excel Discussion (Misc queries) 5 January 7th 08 02:59 PM
Excel Macro to open password protected workbooks? DBM[_2_] Excel Discussion (Misc queries) 3 March 30th 07 04:48 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. Daniel Excel Worksheet Functions 0 June 23rd 05 11:56 PM


All times are GMT +1. The time now is 08:42 AM.

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"