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

VB Script with an Input box? 1

Status
Not open for further replies.

willydude

Programmer
Oct 24, 2006
123
US
I was able to get the following code to work and copy the file(s). I used the same code with different icons (and file names) for a number of different files to move. Here’s the code used:

Code:
Dim Fso, FromWimPC
Set Fso = CreateObject("Scripting.FileSystemObject")
Set FromWimPC = Fso.GetFile("G:\WIM\FileNameGoesHere.dat")
FromWimPC.Copy ("R:\ClientPayrollTimeSheetBackupFiles\")

Then I realized that there is one file that I need to rename before moving it. Each week I copy some timesheet records for a backup. The backup file is originally named "Timesht1.dat". I send it to a DOS/ASCII area where I can open and check the data, save the file, then copy it to a new file with a name such as "TSBK37.dat". It is this last file that I save in my backup folder. I believe my code should have the INPUT box code b/w the third and fourth lines.

I am wanting to click my desktop icon, have an INPUT box or something similar pop up and let me enter the new file name, i.e. “TSBK37.dat” and then move the file to the backup folder upon “ENTER”.

I looked on the MS “Scripting Guys” site ( )
And thought I had something until I read that the code listed only works with XP. The PC that I am using is Win98.

Does anyone know of a way to accomplish the above?

Thanks,

Bill
 
Which version of WSH do you have? I thought Win98 shipped with version 5.1.

Does the following work if you put it in a vbs file and run it?
Code:
xxx = inputbox ("Type something")
WScript.echo "You typed " & xxx
If that doesn't work, then you can try input from the command line
Code:
WScript.Echo "Type Something"
xxx = WScript.StdIn.Read
WScript.Echo "You typed " & xxx
 
XWB,

Sorry it took so long for me to get back. Below is my final code. It does what I need. Thanks for the help.

Bill

Code:
Dim Fso, FromWimPC, FileDate

FileDate = InputBox("Enter the first work date of the week.")

Set Fso = CreateObject("Scripting.FileSystemObject")

Set FromWimPC = Fso.GetFile("G:\WIM\Timesht1.dat")

FromWimPC.Copy "R:\ClientPayrollTimeSheetBackupFiles\" & FileDate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top