Giordano Bruno
Well-known Member
- Joined
- Jan 7, 2007
- Messages
- 1,345
I have the following code in a macro which used to work:
AppActivate "Microsoft Word"
SendKeys ("^v"), Wait:=True
SendKeys "{RIGHT 3}", Wait:=True
AppActivate "Microsoft Excel"
It has now decided to stop at the first of these lines with a Run-time error 5. Invalid procedure call or argument.
If I comment out the line, manually change focus to the already open Word window and continue the macro, it happily deals with the last line and returns focus back to Excel.
A couple of days ago this code was working for me and I can't think what may have made the difference or why it is failing me now
AppActivate "Microsoft Word"
SendKeys ("^v"), Wait:=True
SendKeys "{RIGHT 3}", Wait:=True
AppActivate "Microsoft Excel"
It has now decided to stop at the first of these lines with a Run-time error 5. Invalid procedure call or argument.
If I comment out the line, manually change focus to the already open Word window and continue the macro, it happily deals with the last line and returns focus back to Excel.
A couple of days ago this code was working for me and I can't think what may have made the difference or why it is failing me now