Protectin Spreadsheets/userform

  • Thread starter Thread starter Swift2003
  • Start date Start date
S

Swift2003

I've used Visual basic editor in excel to create a user interface form
It uses textboxs to return and set values on the spreadsheet. Also th
userform starts when the workbook is started and it Minimizes exce
leaving just the userform visible. Everything works fine apart from
few points.

if the 'X' in the top right hand corner of the userform is presse
instead of the buttons i've created the userform closes leave the use
free to fiddle with the workbook.

i cant just protect the sheets because the userform needs to mak
alterations

is there a way to write the protection password into the form code s
the user will never have to know it and the userform can just lift/se
the protection password just before/after the commands.??

plz help this is the final step til it's finishe
 
Certainly can...

ActiveSheet.Protect Password:="bubba"
ActiveSheet.Unprotect Password:="bubba"

Similar things for the workbook. Look up Protect and Unprotect in hel
for more info.
 
thanks between your my post and your reply i did look and found the
answers. Something i couldn't find the answer to is how to create a
password form. Where if correct password is entered another form is
loaded.

any tips??
 
I've done it in VB6, but couldn't get an official password box in Exce
VBA (the one with the asterisks). What I do is create a small userfor
to enter a visible password. Then if it is whatever I code in as ok
launch another form (NewForm.Show) and close it (Unload PasswordForm).
 
if using a userform, then assign * to the passwordchar property of the
textbox
 
I thought for sure I tried that!!! Hopefully it arrived in VBA durin
my last Excel upgrade (rather than the onset of senility).
 
It has worked for me since xl97 when activeX controls and userforms were
introduced.
 
ok, so i've managed to protect 90% of it, how do i stop a fiddler fro
simply disablin macros so my userform doesn't load and then startin VB
and start messin around with my code/forms ??
 
Use Userform_queryclose event

if closemode = vbformcontrolmenu then
cancel=true
End i
 
Well, there wouldn't be any way to do that with a workbook. You might have
more success with an addin.
 

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

Back
Top