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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Files With Input Box

Status
Not open for further replies.

jmdnn10

Programmer
Mar 19, 2012
2
US
Hi,

I'm looking for the following:

I want an executable to run at startup. Within the program is vbscript to open an input box. When I press a designated key combination, i.e. alt + 0, an input box opens. Into the input box I type predetermined file knicknames, that associate to actual files. When I type the knickname, it looks up the corresponding file name and opens the file.

Can anyone help with this code?

Thanks
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Essentially my main dilemma is this. I've been away from code for so long that I'm relearning it. I've been able to piece together an input box and the file open commands, but seperately. Input box is below, although that requires typing in the actually file name. I'm not sure how to go about the knickname assignments.

sub shell(cmd)
' Run a command as if you were running from the command line
dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run(cmd)
Set objShell = Nothing
end sub

dim file_name
' Ask the user for a parameter
file_name = inputbox("What file to see?", "File name?", "c:\boot.ini")
if file_name <> "" then
' The user gave the parameter. Open the program
' with the value the user gave.
shell "H:\Desktop\tester.xls" & file_name
else
msgbox "User cancelled.", 16, "User cancelled"
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top