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

Write to text file with SolidWorks Macro

Status
Not open for further replies.

boilerSWuser

Mechanical
Joined
Dec 2, 2008
Messages
5
Location
US
I want to write different user inputs to a text file using a solidworks macro without writing over what is already there. Below is the code i have that writes over what is currently in the text file. Does anyone know how i can append the text without writing over it? I also want to record the "last saved by" infomation in the text file. How may i do that?

Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\Users\Rn\Documents\testfile.txt", True)
a.WriteLine ("This is a test.")
a.WriteLine (gUSOutsideDia & vbTab & gUSBaseCircle)
a.Close

I have searched through the API help but can't seem to find anything.

Any help would be great!
 
This is Microsoft Scripting functionality. Google for CreateTextFile and you'll find loads of usage and examples.

-handleman, CSWP (The new, easy test)
 
Ok, I have the code fixed that that it does not write over other text and thank you very much for your help but how would i write the last saved information to the file too?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top