Changing macro using macro

U

Ulf Nilsson

Hi,
I have lots of files that contain macros that need to be changed. The
changes are:
- changing a textbox Lock from False to True
- search and replace text in the macro
- delete some text

How can I loop through all these files and do the changes? The macro is
protected with password.

I know how to loop through the templates and do changes in the document
itself, but not how to change the macros.

/ Ulf
 
J

Jonathan West

Ulf Nilsson said:
Hi,
I have lots of files that contain macros that need to be changed. The
changes are:
- changing a textbox Lock from False to True
- search and replace text in the macro
- delete some text

How can I loop through all these files and do the changes? The macro is
protected with password.

This means you are stuck. There is no way to modify a VBA project using code
even if you know the password, unless you first use one of the password
cracking tools that are about on the internet to break the password
altogether.
 
U

Ulf Nilsson

Sorry for being unclear. I have created the macro and I know the password.

/ Ulf
 
J

Jonathan West

Ulf Nilsson said:
Sorry for being unclear. I have created the macro and I know the password.

I realise that. You are still stuck, because there is no means available *in
code* to gain access to the VBProject object of a document or template if
the project has been password protected, even if you know the password.
Believe me, if there were a way, I would find it incredibly convenient to be
able to use it myself!
 
U

Ulf Nilsson

Thanks anyway. At least I do not need to look any further. Just long hours
ahead of me to open each template and do the changes manually.

/ Ulf
 
U

Ulf Nilsson

Hi,
I found another solution:
Since I repeat the same movement and delete the same kind of code everytime,
I used a program called WinMacro to record my movements and deletion. The
program can be found at http://www.geocities.com/win_macro/.

This helped me.

/ Ulf
 

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

Top