PDA

View Full Version : Solved: Unwanted quotationmarks



jokko
01-22-2006, 06:43 AM
Hello,
I am trying to export data from a worksheet into a text file for use by a different application. The problem is that during export quotation marks are added. For instance: A single cell contains the text: >12345,?text1?,?text2?<. And that is how it should appear in the textfile as well. Instead it appears as : >?12345?,??text1??,??text2??<. Not quite what it should be.

The code I am using:

Dim Waarde As DataObject
Set Waarde = New DataObject
Cells(1, 1).Copy
Waarde.GetFromClipboard

Open ThisWorkbook.Path & "exporteren.txt" For Output As #1
Write #1, Waarde.GetText
Close #1

Does anybody have a sugestion?

Jokko:motz2:

OBP
01-22-2006, 06:49 AM
The first questoin is why?
Why not just use "Save as" and choose text.

jokko
01-22-2006, 08:11 AM
I have tried but with the "save as" command I save the entire workbook as a text file and want want to save just a range.

Jokko

OBP
01-22-2006, 08:33 AM
If it is one or more ranges just open a blank Workbook and paste the range(s) in to cell a1 on sheet1 and save the blank workbook as a txt file. I just did it and it worked fine, but I did not use your data.

Bob Phillips
01-22-2006, 08:57 AM
Dim Waarde As DataObject
Set Waarde = New DataObject
Cells(1, 1).Copy
Waarde.GetFromClipboard

Open ThisWorkbook.Path & "exporteren.txt" For Output As #1
Print #1, Waarde.GetText
Close #1

OBP
01-22-2006, 09:02 AM
xld, that is a nice bit of coding. I am envious of your VBA knowledge.

Bob Phillips
01-22-2006, 09:35 AM
xld, that is a nice bit of coding. I am envious of your VBA knowledge.

it's just experience, been there, done that.

jokko
01-22-2006, 10:06 AM
I wished all were that simple. Thanks XLD