Excel, button for macro

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...
 
S

stew

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" ?
 
D

dg.courbat

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.
 
D

Dave Peterson

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"
 

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