Prompt for VBAproject password
If sendkeys was the solution, then I expect that the solution included
showing the dialog. If you want to omit including the password, then that
should get you want you want. You can search google for this group and
keyworkds like
project password sendkeys
--
Regards,
Tom Ogilvy
"Eric van Uden" <eric[ @ ]doornroosje[ . ]nl wrote in message
...
Hello Tom,
I'm afraid I may not have expressed myself clearly before.
I am not looking to unlock the project by means of code. It would be
rather
pointless to lock my code behind a password and then provide an easy way
to
dismiss with it.
I want to supply the password by hand, but at least be prompted for it.
Like what happens when you call 'Application.Worksheets(1).Unprotect' with
a
worksheetbutton and the worksheet has a password set.
At this moment I only get Error 50289, saying that Excel cannot execute
the
macro because the project is protected.
So maybe I need the part just before where I could enter the SendKeys bit
;-)
To explain my intentions: I use template to create enduser workbooks.
Once individualised I want to finalise the workbook. E.g., some formulas
link to other workbooks. These formulas can be replaced by their values,
so
the workbook will load faster. Some modules also become redundant, and I
want to delete them. But this is not possible while the project is locked.
It would be fastest and safest if I would be prompted for the password,
supply it by hand and then have the cleanup-code execute.
Eric
"Tom Ogilvy" schreef in bericht
...
Unlocking the vba project with code isn't supported in VBA. As a
workaround, sendkeys has been offered in the past.
--
Regards,
Tom Ogilvy
"Eric van Uden" <eric[ @ ]doornroosje[ . ]nl wrote in message
...
Hello newsgroup,
I have a macro that manipulates a workbook to make it a definitive
version.
This includes replacing formulas with their values and deleting a code
module that is no longer needed.
The macro is executed with a button in the worksheet.
The VBAproject is locked with a password.
Now, of course, the macro that would delete the code module will not
execute
because the project is locked.
Is there any way to prompt for the VBA password when the worksheet
button
is
pushed, then executing the macro when the project is unlocked?
I Hope I'm making sense. Thanks in advance for any suggestions.
Eric
|