Excel, button for macro

  • Thread starter Thread starter dg.courbat
  • Start date Start date
D

dg.courbat

Hello,
I have a protected (real password... not just protection wihout
password..) template with a button who star a macro. The macro change
some informations, use the filters and print the result. When I push
the button, the system ask for the password.
Do you have ideas ? Thank you for your help. DG
NB : I don't want put the password in the macro, means unprotect and
protect the worksheet in the macro...
 
Can you clarify what you mean by Template (i.e. do you have a XLT
template, or just a normal XLS workbook)?

I'm assuming you have used "Protect Sheet" from the Tools menu?

What are trying to protect with the password? If you can explain there
may be alternative approaches. i.e. could you save the file as Read-
Only and then remove the "Protect Sheet" ?
 
Can you clarify what you mean by Template (i.e. do you have a XLT
template, or just a normal XLS workbook)?

I'm assuming you have used "Protect Sheet" from the Tools menu?

What are trying to protect with the password? If you can explain there
may be alternative approaches. i.e. could you save the file as Read-
Only and then remove the "Protect Sheet" ?

Hello,
It's a template (xlt) I protected the worksheet from Tools menu in
Excel application.
If I just use Tools, Protection, Protect sheet and push the button
"OK" the sheet is protected but wihout password and in this case I
don't have any problem when I execute the macro.
Some people can modify the worksheet but not the regular users. We are
not able to change the files properties on the network...
Thank you. DG.
 
If you used a commandbutton from the control toolbox toolbar, you can add this
line to the top of your code:

me.unprotect password:="TheRealPasswordHere"
'then your code
me.protect password:="TheRealPasswordHere"


If you used a button from the Forms toolbar, you can use:

Activesheet.unprotect password:="TheRealPasswordHere"
'then your code
Activesheet.protect password:="TheRealPasswordHere"
 
Back
Top