Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Dec 2, 2008
5
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!
 
Replies continue below

Recommended for you

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