ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SendKeys (https://www.excelbanter.com/excel-programming/418828-sendkeys.html)

Arnie

SendKeys
 
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

Gary''s Student

SendKeys
 
Send a bunch of backspaces
--
Gary''s Student - gsnu200809

Arnie

SendKeys
 
sorry not following you

"Gary''s Student" wrote:

Send a bunch of backspaces
--
Gary''s Student - gsnu200809


joel

SendKeys
 
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


Arnie

SendKeys
 
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


joel

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



All times are GMT +1. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com