Appending REF Field data to a csv file

D

dnguyen411

I'm trying to write a macro to take REF field data in MS Word and save/append
that data in a csv file.

So far, I've been able to pull the REF field data and put it in a variable
named sOutput.

(i.e. [sOutput = sInvno & ", " & sDate & ", " & sPartno & ", " & sSerno & ",
" & sDesc & ", " & sStatus & vbCr])

The output of this variable outputs each of the data points comma separated.
I want to take this data, append it to a csv file and automatically save it
without any user interaction. I haven't been able to find any code that can
help me.

Can somebody help me out?

Thanks, Davis
 
D

David Sisson

Sub TextFile()

Dim FileNum As Integer

FileNum = FreeFile

Open "MyData.txt" For Append As FileNum

sOutput = sInvno & ", " & sDate & ", " & sPartno & ", " & sSerno & ",
" & sDesc & ", " & sStatus & vbCr

Print #FileNum, sOutput

Close FileNum
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top