G
Guest
I am maintaining a db that creates a legal document using SendKeys.
It formats the page in the necessary format using SendKeys to send Alt and
Ctrl sequences.
The first thing the code does, after creating the word doc is to format the
margins and tabs, but the code processes too fast and by the time Word is
ready to move on, several other SendKeys commands have been sent by
VBA/Access.
These keystrokes come in while Word is still 'thinking' and are therefore
ignored.
The routine used to work (pre-Win XP) but now no longer works.
Here is the sample code that is not working right.
Set WordObj = CreateObject("Word.Basic")
WordObj.Filenew
WordObj.AppShow "Microsoft Word"
WordObj.SendKeys "%f", True
WordObj.SendKeys "u.75{TAB}.75{TAB}.5{TAB}.5{ENTER}", True
WordObj.SendKeys "% ", True
by the time this code has run the program is already behind, and future
keystrokes get sent to the tab control form that is still open because the
above keystrokes did not process fast enough.
Now, I have tried inserting a line that counts from 1 to 15,000,000 after
each SendKeys command, and that works on some computers, but some still have
a problem with it.
Any help would be appreciated.
Wanna be
It formats the page in the necessary format using SendKeys to send Alt and
Ctrl sequences.
The first thing the code does, after creating the word doc is to format the
margins and tabs, but the code processes too fast and by the time Word is
ready to move on, several other SendKeys commands have been sent by
VBA/Access.
These keystrokes come in while Word is still 'thinking' and are therefore
ignored.
The routine used to work (pre-Win XP) but now no longer works.
Here is the sample code that is not working right.
Set WordObj = CreateObject("Word.Basic")
WordObj.Filenew
WordObj.AppShow "Microsoft Word"
WordObj.SendKeys "%f", True
WordObj.SendKeys "u.75{TAB}.75{TAB}.5{TAB}.5{ENTER}", True
WordObj.SendKeys "% ", True
by the time this code has run the program is already behind, and future
keystrokes get sent to the tab control form that is still open because the
above keystrokes did not process fast enough.
Now, I have tried inserting a line that counts from 1 to 15,000,000 after
each SendKeys command, and that works on some computers, but some still have
a problem with it.
Any help would be appreciated.
Wanna be