View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Unlock project for viewing within a macro

You should be able to save the workbook with the project locked or unlocked.

What happened when you tried it?

P McConnell wrote:

I'd like to protect the macros in a workbook but allow the user to save it as
a different filename. Once I lock the VBAProject I can't save as another
name. I'm thinking a solution would be to wrap unprotect and re-protect
around the save (if that's possible), but I'm stumped on the code. Please
see below...

'I need code to unprotect project here
ConNum = TextBox1.Value
ActiveWorkbook.SaveAs Filename:="C:\Orders\" & ConNum & ".xls"
Application.RecentFiles.Add Name:=ThisWorkbook.FullName
'Also code to protect project here

Thanks!


--

Dave Peterson