ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding Macro from View (https://www.excelbanter.com/excel-programming/277053-hiding-macro-view.html)

John Telly

Hiding Macro from View
 
I am an intermediate user of Excel. I have a workbook
with multiple worksheets which is sent out to multiple
individuals for updating. I was helped with writing a
Macro to protect all worksheets from changes and also
unprotect.
My problem is that the Macro and the passwords are visible
to the individuals I send the files to.

Is there any way I can make the Macros invisible? If
possible, please provide "idiot proof" step-by-step
instructions as I am very poor in macros and programming.

In case you need to know, here are the macros to protect
and unprotect:

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Protect Password:=""
Next a
End Sub

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Unprotect Password:=""
Next a
End Sub




John Wilson

Hiding Macro from View
 
John,

From the VBA Editor (Alt + F11)
Tools/VBAProject Properties
"Protection" tab
Check "Lock Project for Viewing"
Enter passwords.

Please note that an experienced user can find ways to crack this
(or any other password protection) that you might incorporate
in your workbook. Excel is by no means secure.

John

John Telly wrote:

I am an intermediate user of Excel. I have a workbook
with multiple worksheets which is sent out to multiple
individuals for updating. I was helped with writing a
Macro to protect all worksheets from changes and also
unprotect.
My problem is that the Macro and the passwords are visible
to the individuals I send the files to.

Is there any way I can make the Macros invisible? If
possible, please provide "idiot proof" step-by-step
instructions as I am very poor in macros and programming.

In case you need to know, here are the macros to protect
and unprotect:

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Protect Password:=""
Next a
End Sub

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Unprotect Password:=""
Next a
End Sub



Ron de Bruin

Hiding Macro from View
 
Hi John

Use a password also in the code
Worksheets(a).Protect Password:="something"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"John Telly" wrote in message ...
I am an intermediate user of Excel. I have a workbook
with multiple worksheets which is sent out to multiple
individuals for updating. I was helped with writing a
Macro to protect all worksheets from changes and also
unprotect.
My problem is that the Macro and the passwords are visible
to the individuals I send the files to.

Is there any way I can make the Macros invisible? If
possible, please provide "idiot proof" step-by-step
instructions as I am very poor in macros and programming.

In case you need to know, here are the macros to protect
and unprotect:

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Protect Password:=""
Next a
End Sub

Sub test ()
Dim a As Integer
For a = 1 To Worksheets.Count
Worksheets(a).Unprotect Password:=""
Next a
End Sub






Ed Lisay

Hiding Macro from View
 
John,

This should fit your need.
I have several VBA applications that I not only want to
protect the code, but also need to prevent the User from
running a macro out of sequence (They click a button to
run them).
1. First, protect all the macros with password.
In the workbook load event, set a variable to a value.
For example:
okToRun = False
2. Then in each marco, add code to check the value of a
variable.
if example:
If okToRun = False Then
MsgBox "You are not authorized to run this macro." &
vbCrLf & "Contact for additional
information.", vbExclamation, "Security Warning"
Exit Sub
Else: End If
3. Then in the event that allows the User to run the
macro (clicking the command button in my example), set
the variable to True:
okToRun = True

Show, the macros are still visible, but can't be run
unless the button is clicked.
Hope that helps. Email me if you have any questions.

Ed



All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com