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

makefile command, I think

Status
Not open for further replies.

jason12776

Technical User
Nov 15, 2001
93
US
I want to create a log file for an application I am creating. When the user clicks on the save button, I want information to be written to a log file. I know how to do all of it, but I don't want the user to create a blank .txt file in a certain location. I want the program to automatically create the file if it doesn't exist. I thought it was the makefile command but I can't seem to find much on it. Can anyone help me out?


Cheers.
 
can't you use

Open "log.txt" For Append As #1
Write #1, "Did This" 'deleiminated
'Print #1, "Did this"
Close #1

If the file doesn't exists it will be created

Grant
 
Do you mean "CreateFile", as used in a FileSystemObject? Something like:

Set fso = CreateObject("Scripting.FileSystemObject")
Set NewLog = fso.CreateTextFile("c:\Log.txt", True)
NewLog.WriteLine("This is a test.")
NewLog.Close

Can also test for the existence of previous logfile first using the "FileExists" method. VB/VBA Help should give you some examples if you need help, but hope this points you along the right path

Asjeff

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top