password protect project with VBA code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All.
For Ex03, how do I password protect the project from within the VBA code?

I can't find the equivalent coding I've used for protecting a workbook, or a
worksheet.


I have 2 workbooks, Workbook1, and Workbook2.
Using code running in Workbook1, a module in Workbook1 is copied into
Workbook2. After the copy I want to password protect the VBE in Workbook2.
How do I do it? Do I have to do a Save As... of Workbook2?
Thank you for looking at my posting.
Paul
 
The object model does not support this. You MIGHT be able to use
SendKeys to send the appropriate keystrokes, but I wouldn't count
on it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
[This followup was posted to microsoft.public.excel.programming and a
copy was sent to the cited author.]

The object model does not support this. You MIGHT be able to use
SendKeys to send the appropriate keystrokes, but I wouldn't count
on it.

I was wondering the same thing; especially after reading some of the
examples/utilities available on Chip's site relating to Programming to
the VB Editor.

I have a series of workbooks for a number of hospitals that I "build"
for other consultants.

The VBA code in all those is "protected".

I recently discovered an error in one of the Sub Procs in one of the
modules in those spreadsheets.

The offending Sub Proc is called by a command button on two of the
sheets in the hospital workbooks.

As such, ideally, I would have liked to have been able to send them a
"Fix" workbook w/ some VBA code that would have opened the offending
module in each of the hospital specific workbooks, corrected the 4 lines
of code in a particular Sub Proc (probably be deleting the entire Sub
Proc and then inserting a new, corrected, one), exit and then they could
use the command buttons as intended.

But as they are all "protected", like Chip warns on his site, the code
didn't work.

Chip, can you give us a few lines of how we might play w/ SendKeys to
open a module in another workbook?

Thanks
 

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