Thread: SendKeys
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default SendKeys

It looks like I'm missing a space in the following instruction

from
MyAppID = Shell("notepad.exe" & FName, 1) ' Run Microsoft Word.
to
MyAppID = Shell("notepad.exe " & FName, 1) ' Run Microsoft Word.


You don't have to open a notepad application if the window is already
opened. You can use the Window name instead of the process ID in the
AppActivate

AppActivate "AnyThing.txt"


"Arnie" wrote:

Thanks Joel :-)

"Joel" wrote:

Try this code. It opens a Notepad application using your filename and then
sends the key to the active window.

Sub test()
FName = "C:\Documents and Settings\Fred_Bloggs\" & _
"My Documents\Folder1\Folder2\AnyThing.txt"

MyAppID = Shell("notepad.exe" & FName, 1) ' Run Microsoft Word.
AppActivate MyAppID ' Activate Microsoft

SendKeys "{Enter}", Wait:=True

End Sub


"Arnie" wrote:

can anyone help i am using

SendKeys "C:\Documents and Settings\Fred_Bloggs\My
Documents\Folder1\Folder2\AnyThing.txt{Enter}", Wait:=True

however i want anyone to use this so i want to get rid of "Fred_Bloggs"

i tried

SendKeys Thisworkbook.Path & "\Folder2\AnyThing.txt{Enter}", Wait:=True

but its not happy any ideas?

Thanks
Arnie