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

excel - macro saving to txt, but with " " right now 1

Status
Not open for further replies.

smooveb

IS-IT--Management
Jul 20, 2001
161
US
Hi everyone,

I've got a macro that is saving my one column spreadsheet in excel to a txt format for uploading into another application. The problem is that A is turning into "A" during the Save As Txt

Any ideas on how I can avoid this happening?

Thx!
Barrett
 
If your using the [tt]SaveAs()[/tt] method, change the format to [tt]xlUnicodeText[/tt].

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
thanks for the idea! unfortunately, it didn't work.

any other thoughts? appeciate it for sure!

Barrett
 
You could try the other text options to see if one of them will play nice.

I would just write my own routine to create the file, but I'm a programmer.
Code:
[navy]Sub [/navy] OutputFile()
[navy]Dim[/navy] wksSource [navy]As[/navy] Worksheet
[navy]Dim[/navy] lngRow [navy]As Long[/navy]
[navy]Dim[/navy] intFile [navy]As Integer[/navy]
Set wksSource = Worksheets("sheet1")
intFile = FreeFile
[navy]Open[/navy] "C:\Book1.txt" [navy]For Output As[/navy] #intFile
[navy]Do[/navy]
  lngRow = lngRow + 1
  Print #intFile, wksSource.Cells(lngRow, 1)
[navy]Loop Until[/navy] Trim(wksSource.Cells(lngRow, 1)) = ""
[navy]Close[/navy] #intFile
[navy]Set[/navy] wksSource = [navy]Nothing[/navy]
[navy]End Sub [/navy]

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
well heck, that was easy ;)

thanks a lot CMP!!

Barrett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top