Save protected file into unprotected file without password

P

Paul

I have a master workbook file which is password protected.
I want to create a procedure that a user access and save
the protected template file into his/her own unprotected
file before he/she start updating the file without
password entry.
I have recorded an "ActiveSheet.Unprotect" macro. However,
I was ask to enter the "Password" when I ran the macro. Is
it possible to create a macro which unprotects and saves
the file into a new unprotected file without password
entry? There is no purpose protecting the file if I have
to let all users know the password.

Thanks,
Paul
 
I

ijb

Paul,
if you put the unprotect password into your Activesheet.Unprotect macro and
then password protect that module - this will keep the password secret (your
users will be able to modify the spreadsheets but won't be able to see the
code which unprotects them)

Hope this is clear - if not I can write the code for you and post it.

--
If I've mis-understood the question please tell me.

HTH

ijb

Remove nospam from my e-mail address to talk direct

Not MCSD, MVP, TLA, P&P, PCMCIA, etc just trying to help
 
D

Dave Peterson

With Activesheet 'maybe worksheets("sheet1") to be careful???
.unprotect password:="topsecret"
'do your stuff
.protect password:="topsecret"
end with

When you record the macro, the password parm doesn't get recorded. But it's
there in the help.

And to add to IJB's response, you'll want to protect the project.
Inside the VBE, click on tools|VBA Project Properties|protection Tab.

Give it a nice password and click lock for viewing.

(And remember this password--it can be different from the worksheet's password.)

All that said, there are routines posted here several times a week that will
crack worksheet protection. And pointers to commercial password breakers for
your VBA code (inexpensive, too).
 
T

Tom Ogilvy

Here is a possible approach:

Sub Tester2()
workbooks("Master.xls").Activate
Set sh = ActiveSheet
Workbooks.Add xlWBATWorksheet
With sh
.Cells.Copy ActiveSheet.Cells
End With
End Sub

alter to copy each sheet if the workbook is multiple sheets.

Regards,
Tom Ogilvy
 

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