help with functions

K

Kirsty

does anybody know if it is possible to password protect a macro and how to do
it? It is part of a college project and I am trying to find out information
on the subject. I am also interested in any information on the editing of the
layout of forms and how to create tabs and scroll menus within them.
 
J

JulieD

Hi Kirsty

for your first question -
i was going to suggest that you went and checked the help files in the VBE
Window (as its a college project and all) but when i did that i couldn't
find the answer and i knew what i was looking for! :)
so in the VBE window, have a look under Tools / VBAProject Properties and
the Protection tab.

for the second -
check out help (in the VBE window) for Multipage & scrollbar ... the
articles you want have (Forms) in brackets after the topics .. there's
heaps there which should provide plenty of information - if you then have
further specific questions please feel free to post back.

Cheers
JulieD
 
A

Alan

If you want to prevent anyone looking at the macro code then Julies answer
is fine, however if you want a password to run the macro you could use the
code below. Bear in mind though that Excel protection is weak and VB code
can be accessed and altered by anyone with the knowledge and inclination to
do so. It will though prevent the average user without in-depth knowledge
from running the macro. Needless to say if you use this, protect the code as
in Julies reply!

Sub Password()
Dim Pass, Response
Pass = "Password" 'Change to your password, text is case sensitive
Response = InputBox("Please enter the password to run this macro")
If Response <> Pass Then
MsgBox "Incorrect Password"
Exit Sub
Else
'Enter your code here
End If
End Sub

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top