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!

how to create a new text file 1

Status
Not open for further replies.

FacilitiesCAD

Technical User
Aug 4, 2003
39
US
I am looking to create a text file through access. Right now i have code that moves a drawing file (.dwg) to a new location based on some orginzational criteria. What I want to do now is create a text file with the name old.txt. (where old is the old .dwg file name) that says "file was moved to new" where new is the new file name. any ideas how to do this. old and new are variables in my code on a form.

ideally I want something like this:

open notepad
insert string_new
saveas string_old
close notepad


Tim
 
Try this...

Dim String_Old As String
Dim String_New As String

String_Old = "C:\Old.dwg"
String_New = "C:\New.dwg"

'Replace file extention with .txt
String_Old = Left(String_Old, Len(String_Old) - 4) & ".txt"

Open String_Old For Output As #1 ' Open file for output.
Print #1, "This file was moved to " & String_New
Close #1 ' Close file.

Should work ok!
 
Sounds like a great way to do it. I was looking a a different post (since I wrote mine) and saw it done in a similiar way.

Thanks, have a star.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top