PDA

View Full Version : Solved: Output Data from a Userform to a txt file



jason_kelly
12-15-2010, 09:00 AM
Hi There,

I need your help,

at the click of a button, id like to have excel, export the values of my userform to a txt file and open it for viewing.

I have attached the copy of my userform and the desired ouput contained within the excel file.

Any help with this is greatly appreciated.

Thanks,

Jay

Bob Phillips
12-15-2010, 09:25 AM
No attachment.

jason_kelly
12-15-2010, 10:09 AM
Hi There,

My appologies,

I didn't know there was a cap on the attachment size.

I've zipped it instead.

shrivallabha
12-16-2010, 07:00 AM
You can use FileSystemObject to create file and then to add your data.

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Writer = FSO.CreateTextFile("C:\MyPath\MyFile.txt", True)

Then use the WriteLine to write into the file:
Writer.WriteLine ("Logfile created by: Admin on" & Date)

Then choose Append option to add the data line by line using:
Set Writer = FSO.OpenTextFile("C:\MyPath\MyFile.txt", 8)
Writer.WriteLine ("Converterfile used by: " & Application.UserName & " On: " & Date)

Regards,

jason_kelly
12-16-2010, 11:28 AM
Thanks very much shrivallabha!

That worked great!

Cheers and all the best