Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default vba project properties via code

I have a rather large group of files to modify. The vba modules of each are
'nearly' identical, and I need to add or remove code from each one. I have
the code in place to modify them, but each one has their vba project password
protected (al with the same passord).
How do I pass the password to the project from within my code to unlock
those other projects before I modify them. (Note I do not wish to remove the
protection, just open the projects, modify and get out again.)
If I open them and unlock manually, it could take me days, and the point of
my project is to do this in a matter of minutes, to force them all to use the
same external code for their processing.
Thanks!!
Tim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default vba project properties via code


It can be done, but it involves the use of SendKeys which isn't too stable.

This is an example, but you may need to tune it

With Application
.SendKeys "%{F11}", True ' VBE
.SendKeys "^r", True ' Set focus to Explorer
.SendKeys "{TAB}", True ' Tab to locked project
.SendKeys "~", True ' Enter
.SendKeys "password"
.SendKeys "~", True ' Enter
End With

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Tim Rush" wrote in message
...
I have a rather large group of files to modify. The vba modules of each
are
'nearly' identical, and I need to add or remove code from each one. I
have
the code in place to modify them, but each one has their vba project
password
protected (al with the same passord).
How do I pass the password to the project from within my code to unlock
those other projects before I modify them. (Note I do not wish to remove
the
protection, just open the projects, modify and get out again.)
If I open them and unlock manually, it could take me days, and the point
of
my project is to do this in a matter of minutes, to force them all to use
the
same external code for their processing.
Thanks!!
Tim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default vba project properties via code

hi Tim,
you can use SendKeys to unlock vba protection

pw = "password"
SendKeys "%{F11}%xi" & pw & "{ENTER}{TAB 6}{ENTER}", True

don`t know if this still works with XL2007.

stefan


On 9 Jun., 13:05, Tim Rush wrote:
I have a rather large group of files to modify. *The vba modules of each are
'nearly' identical, and I need to add or remove code from each one. *I have
the code in place to modify them, but each one has their vba project password
protected (al with the same passord). *
How do I pass the password to the project from within my code to unlock
those other projects before I modify them. *(Note I do not wish to remove the
protection, just open the projects, modify and get out again.)
If I open them and unlock manually, it could take me days, and the point of
my project is to do this in a matter of minutes, to force them all to use the
same external code for their processing.
Thanks!!
Tim


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default vba project properties via code

Great... Took me a while to figure what was happening, but I mangaed to use
it. First time using SendKeys. I can see its instability, but if careful,
it could be powerful too.
Since I found no way to tell it which workbook to tab through, I cycled it
through all of them. The active workbook is not always the first one listed.

Thanks for the help!


"Bob Phillips" wrote:


It can be done, but it involves the use of SendKeys which isn't too stable.

This is an example, but you may need to tune it

With Application
.SendKeys "%{F11}", True ' VBE
.SendKeys "^r", True ' Set focus to Explorer
.SendKeys "{TAB}", True ' Tab to locked project
.SendKeys "~", True ' Enter
.SendKeys "password"
.SendKeys "~", True ' Enter
End With

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Tim Rush" wrote in message
...
I have a rather large group of files to modify. The vba modules of each
are
'nearly' identical, and I need to add or remove code from each one. I
have
the code in place to modify them, but each one has their vba project
password
protected (al with the same passord).
How do I pass the password to the project from within my code to unlock
those other projects before I modify them. (Note I do not wish to remove
the
protection, just open the projects, modify and get out again.)
If I open them and unlock manually, it could take me days, and the point
of
my project is to do this in a matter of minutes, to force them all to use
the
same external code for their processing.
Thanks!!
Tim




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Project Explorer and Properties window (VBA) have disappeared Ben Excel Programming 4 June 14th 07 02:10 PM
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
Workbook with no properties attaches itself to my VBA project [email protected] Excel Discussion (Misc queries) 4 January 16th 07 06:06 PM
VBA Project Properties dipitiduda2 Excel Programming 0 January 18th 06 07:55 PM
Locking VBA code via Project properties but cannot save the workbook over itself Shane Excel Programming 4 July 27th 04 01:00 AM


All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"