VBAProject Protect

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

The following code is present in a subroutine in a
standard module.

Sheets("NEXTRECORD").Visible = xlVeryHidden

No problem as long as the VBAProject is not protected.

What code would I use to protect and unprotect the
VBAProject?

Thanks in advance.


Kevin
 
Hiding a sheet shouldn't be affected by project protection. It would be
affected if the workbook structure is protected.
 
Thanks Tom.

Yes, the Workbook is protected. The VBA code also
includes,
Workbooks(WorkbookName).Protect Password:=DwgNumLogPwd
where WorkbookName is set to,
WorkbookName = Sheets("INPUTDATA").Range _
("strFileName").Value
in a separate module.

Mea culpa.

Kevin
 
Problem resolved.
I realize I don't need to protect/unprotect the VBAProject.
A simple,
Workbooks(Name).UnProtect Password:=DwgNumLogPwd
<code>
Workbooks(Name).Protect Password:=DwgNumLogPwd
works.

Kevin
 

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