Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to concantenate a variable into SendKeys

Status
Not open for further replies.

spottiepop

Technical User
Nov 5, 2002
2
US
I'm a newbie so please forgive me if I'm going about this all wrong. I want to open a file in an application using WScript.shell and the run method. I can get the file to open in the app using SendKeys but only as a literal "somefile.m". Is there a way to pass SendKeys a variable that you create?
 
YourStringVariable = "Some String"

object.SendKeys YourStringVariable

This I hope helps you.

Randy
smiletiniest.gif


You can Email me at: RCooper@cinci.rr.com
 
Thanks! Randy
I tryed doing this but it does not seem to work. My code looks something like this.

Dim NcamObject, manu_File

Set manu_File = InputBox("What Manuscript do you want to open?", "Open Manuscript VBScript!")


Set NcamObject = WScript.CreateObject("WScript.Shell")

NcamObject.Run "NICAMIV.exe"

Open_Manuscript()

Function Open_Manuscript()

'Pause script execution to allow Windows to load Nicamiv
WScript.Sleep 1500

NcamObject.SendKeys "LO {ENTER}"
WScript.Sleep 1000
NcamObject.SendKeys "G:\MANU\153\M" & manu_file & {ENTER}

End Function
 
Try changing:
NcamObject.SendKeys "G:\MANU\153\M" & manu_file & {ENTER}

to

NcamObject.SendKeys "G:\MANU\153\M" & manu_file & "{ENTER}"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top