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!

To append a file with the system time 2

Status
Not open for further replies.

vbscript11

IS-IT--Management
Nov 15, 2010
4
IN
Hi all,

I have the below code that will popup a input box and will paste the entered data in the Input box to a file.
But along with this I also want the Date & Time to be displayed (next to the entered data in the file).The code must pick up the date and time from the local machine.

Option Explicit

Const ForAppending = 8

Dim Input,filesys,filetxt,filetxt1,path1,path2

path1="D:\s\"
path2="abcd.txt"

Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt1 = filesys.OpenTextFile(path1 & path2,ForAppending,True)
Input = InputBox("Enter your name")
filetxt1.WriteLine( Input )

Please help.

 
Have a look at the Now function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Code:
filetxt1.WriteLine( Now & vbTab & Input )

Should do it...

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top