Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Macro to password protect

Hi,

Is it possible to run a macro from a button to password protect a file?
and similarly is it possible to remove the password protection from a button?

thankyou for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Macro to password protect

Patrick,

you can do something like this.

'Protect/Unprotect a sheet
Worksheets("Sheet1").Protect Password:="password"
Worksheets("Sheet1").Unprotect Password:="password"

'Protect/Unprotect the active workbook
ActiveWorkbook.Protect Password:="password"
ActiveWorkbook.Unprotect Password:="password"


Lookup the Protect and Unprotect methods in the VBA help for more details on
the available parameters.


--
Hope that helps.

Vergel Adriano


"Patrick Bateman" wrote:

Hi,

Is it possible to run a macro from a button to password protect a file?
and similarly is it possible to remove the password protection from a button?

thankyou for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Macro to password protect

On 28 Aug, 16:46, Vergel Adriano
wrote:
Patrick,

you can do something like this.

'Protect/Unprotect a sheet
Worksheets("Sheet1").Protect Password:="password"
Worksheets("Sheet1").Unprotect Password:="password"

'Protect/Unprotect the active workbook
ActiveWorkbook.Protect Password:="password"
ActiveWorkbook.Unprotect Password:="password"

Lookup the Protect and Unprotect methods in the VBA help for more details on
the available parameters.

--
Hope that helps.

Vergel Adriano



"Patrick Bateman" wrote:
Hi,


Is it possible to run a macro from a button to password protect a file?
and similarly is it possible to remove the password protection from a button?


thankyou for your help.- Hide quoted text -


- Show quoted text -


might also be worth mentioning that it's PROBABLY sensible to password
protect your code as IF the reason for the protection unprotection is
to keep the password secret, all the user needs to do with unprotected
code is view it to find out what the password is.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Macro to password protect

Thankyou for you help much appreciated

" wrote:

On 28 Aug, 16:46, Vergel Adriano
wrote:
Patrick,

you can do something like this.

'Protect/Unprotect a sheet
Worksheets("Sheet1").Protect Password:="password"
Worksheets("Sheet1").Unprotect Password:="password"

'Protect/Unprotect the active workbook
ActiveWorkbook.Protect Password:="password"
ActiveWorkbook.Unprotect Password:="password"

Lookup the Protect and Unprotect methods in the VBA help for more details on
the available parameters.

--
Hope that helps.

Vergel Adriano



"Patrick Bateman" wrote:
Hi,


Is it possible to run a macro from a button to password protect a file?
and similarly is it possible to remove the password protection from a button?


thankyou for your help.- Hide quoted text -


- Show quoted text -


might also be worth mentioning that it's PROBABLY sensible to password
protect your code as IF the reason for the protection unprotection is
to keep the password secret, all the user needs to do with unprotected
code is view it to find out what the password is.


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
How to Protect MACRO with Password Amol[_3_] Excel Programming 4 August 7th 07 10:40 PM
Password Protect Macro Dan Excel Programming 2 September 1st 06 07:13 PM
password protect macro Modell Excel Programming 3 April 27th 06 08:59 PM
Password Protect Macro? ryanmhess Excel Programming 4 January 27th 06 04:56 PM
Password protect macro Pete Excel Programming 2 April 16th 04 03:44 AM


All times are GMT +1. The time now is 03:37 AM.

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

About Us

"It's about Microsoft Excel"