Saving as Text without delimeters

jhall07

New Member
Joined
Apr 29, 2014
Messages
9
I am trying to save an worksheet as txt format. Everytime I try to perform this, I am getting quotation marks around each line that includes a comma. So I tried saving it as .prn to avoid the quotation marks. Now, it cuts off any line that has more than 250 characters. Is there any text format that I save my file as that will not add quotations or limit line lengths?:confused:
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I am trying to save an worksheet as txt format. Everytime I try to perform this, I am getting quotation marks around each line that includes a comma. So I tried saving it as .prn to avoid the quotation marks. Now, it cuts off any line that has more than 250 characters. Is there any text format that I save my file as that will not add quotations or limit line lengths?:confused:
Show us your code so we know which approach you are using to do your saves.
 
Upvote 0

jhall07

New Member
Joined
Apr 29, 2014
Messages
9
ChDir strFolder
ActiveWorkbook.SaveAs Filename:= _
strFolder & fname & ".properties", FileFormat:=xlTextPrinter _
, CreateBackup:=False
ActiveWindow.Close (saveChanges = True)
 
Upvote 0

jhall07

New Member
Joined
Apr 29, 2014
Messages
9
I do not want to save with any delimiters. The issue is that excel see's a comma in the text and wants to put quotations around that line when saving in a text format. The only text format that excel will ignore this is .prn. The issue with .prn is that it limits each line to 240 characters. I am just looking to see if anyone knows of a way around this. I could use a batch file to open the generated file to find/replace the quotation marks, but there are some of them that are within the text and need to be there.
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I do not want to save with any delimiters.
Don't you need some kind of delimiter between your data? Without a delimiter, all your cell values on the same row will be concatenated together into one long text string.:confused:
 
Upvote 0

jhall07

New Member
Joined
Apr 29, 2014
Messages
9
Each row in the excel file is saved on its own row in the text file, and that is the intention. Also, there is only 1 column that I am exporting.
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Each row in the excel file is saved on its own row in the text file, and that is the intention. Also, there is only 1 column that I am exporting.
Ah, only one column... good... that makes things nice and easy. Let's say Column A is what you want to save, then Dim a variable named FF as Long, then use this code to write your column of data (assumed to be Column A in the code below) out to you indicated path and filename...

Code:
  FF = FreeFile()
  Open strFolder & fname & ".properties" & ".txt" For Output As #FF
  Print #FF, Join(Application.Transpose(Range("A1", Cells(Rows.Count, "A").End(xlUp)).Value), vbNewLine)
  Close #FF
 
Upvote 0

jhall07

New Member
Joined
Apr 29, 2014
Messages
9
I entered in the code that you provided. I am getting a run time error '13': Type Mismatch for this line:


Print #FF, Join(Application.Transpose(Range("A1", Cells(Rows.Count, "A").End(xlUp)).Value), vbNewLine)
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I entered in the code that you provided. I am getting a run time error '13': Type Mismatch for this line:


Print #FF, Join(Application.Transpose(Range("A1", Cells(Rows.Count, "A").End(xlUp)).Value), vbNewLine)
Do you have more than one cell with data in it in Column A? And are you running the macro with the sheet containing your data selected.
 
Upvote 0

Forum statistics

Threads
1,191,178
Messages
5,985,145
Members
439,942
Latest member
bkexcel11230

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top