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

MS Word VBA newbie - help

Status
Not open for further replies.

cosmoh2o

Programmer
Jul 22, 2002
92
US
I am trying to write a MS Word template with macros that properly format a comma-delimited text file that will be exported to a UNIX server. This newly created text file (called default.csv) will then be imported into our database. I have everything working properly except that the file always places a ^M (carriage return) on the last line of the file (visible when I use VI editor on UNIX). This is bad for our database import. My question is this: How can I remove only the last ^M from default.csv using VBA before the file is exported to the UNIX server.

The file looks like the following:
"20030410030859","04/10/03 UPS","0.00","45632","Y"^M
^M

The problem occurs because the last ^M is imported into our database and a substring error results.

Any help would be greatly appreciated. Like I said, I am a VBA Word newbie. Thanks.
 
Look into VBHelp for Replace Function. Replace the ^M with "".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top