Sign in to follow this  
Followers 0
pixelstudio

Automating Word / VBA

5 posts in this topic

hello people.

i have the following situation.

we have more then 100 .dot files (all containing the same VBA code)

The code needs to be updated for all files.

so i thought i'm gonna use AutoIT for this.

Well this is what i got this far:

reading directory, get all file names

With a filename open Word

in msword i send keys ALT-F11 , Ctrl-r, enter, password

here i'm stuck

what i got now is opening msword for a .dot file and then open the Visual basic editor (f11)

then the Enter and password is for cause all the .dot files have a password on them. so ctrl-r focuses on the project window.

ENTER selects the current project (enter password dialog appears) then i send password and ENTER to round that off

Now what i need to do somehow select the correct module. select the whole function thats need to be updated and replace it with the new version.

Please any help would be Great!!

thanks in advance!

Share this post


Link to post
Share on other sites



hello people.

i have the following situation.

we have more then 100 .dot files (all containing the same VBA code)

The code needs to be updated for all files.

so i thought i'm gonna use AutoIT for this.

Well this is what i got this far:

reading directory, get all file names

With a filename open Word

in msword i send keys ALT-F11 , Ctrl-r, enter, password

here i'm stuck

what i got now is opening msword for a .dot file and then open the Visual basic editor (f11)

then the Enter and password is for cause all the .dot files have a password on them. so ctrl-r focuses on the project window.

ENTER selects the current project (enter password dialog appears) then i send password and ENTER to round that off

Now what i need to do somehow select the correct module. select the whole function thats need to be updated and replace it with the new version.

Please any help would be Great!!

thanks in advance!

why can't you just replace the .dot file on all the PCs?


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

Impossible without using COM. Iffy even then.

Modules are all .BAS files that have been saved in location:\foo\bar\file.bas right?

Do you have to modify the documents or the modules?

And is AutoIt the tool for the job? You could probably go around quite a bit of this headache and use Word to do it. You can send passwords and manipulate stuff within VBA.

Check out this site and start hunting.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Impossible without using COM. Iffy even then.

Modules are all .BAS files that have been saved in location:\foo\bar\file.bas right?

Do you have to modify the documents or the modules?

And is AutoIt the tool for the job? You could probably go around quite a bit of this headache and use Word to do it. You can send passwords and manipulate stuff within VBA.

Check out this site and start hunting.

Lemme explain a bit.

Replacing all .dot files is not going to work.

i have more then 100 .dot files. all having a VBA module. that VBA module needs to be updated. by hand i would do :

open .dot file, look for module/function. copy/past new function and save.

that i need to be done for >100 files (guessing around 500 total files) so by hand it's loads of work

therefor i need to automate this.

Using word/VBA i have tried. but it is impossible to automate WORD with VBA cause the projectfiles (modules) have a password. i cannot connect to this in any way!

So i need to do this outside word. and therefor i asked my question about using AutoIT for this.

hope this makes you understand :)

cheers and thanks in advance

Share this post


Link to post
Share on other sites

pixelstudio,

How did you get all those files to the PCs in the first place? Can't you just make the change on your PC then copy ALL the files out again?

Ralph

Lemme explain a bit.

Replacing all .dot files is not going to work.

i have more then 100 .dot files. all having a VBA module. that VBA module needs to be updated. by hand i would do :

open .dot file, look for module/function. copy/past new function and save.

that i need to be done for >100 files (guessing around 500 total files) so by hand it's loads of work

therefor i need to automate this.

Using word/VBA i have tried. but it is impossible to automate WORD with VBA cause the projectfiles (modules) have a password. i cannot connect to this in any way!

So i need to do this outside word. and therefor i asked my question about using AutoIT for this.

hope this makes you understand :)

cheers and thanks in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0