AgentSmith
Well-known Member
- Joined
- Mar 8, 2004
- Messages
- 575
I have a simple macro that launches WordPad and opens a text file via the command line. Unfortunately WordPad isn't an automation server, so the only way I can think of doing formatting is via the (admittedly horrible) SendKeys command.
My problem is that if I run this macro directly from the VBE environment then the keystrokes are actually done in the VBE window rather than in WordPad. Does Excel give me a way to automatically close the VBE environment completely? I did try this:
but got some really unhelpful error message.
If not then a second best would be to figure out the the VBE environment is open and active. If so then I would bypass the SendKeys bit.
Perhaps there is a way using API calls?
Hope this makes sense. TIA.
My problem is that if I run this macro directly from the VBE environment then the keystrokes are actually done in the VBE window rather than in WordPad. Does Excel give me a way to automatically close the VBE environment completely? I did try this:
Code:
Application.VBE.MainWindow.Close
If not then a second best would be to figure out the the VBE environment is open and active. If so then I would bypass the SendKeys bit.
Perhaps there is a way using API calls?
Hope this makes sense. TIA.