Forum Discussion
JoAvg
Dec 07, 2022Brass Contributor
Help modifying macro - Delete double quotes when saving *.txt
I have this following macro. When saving I get double quotes in every line of the *.scr or *.txt file. Tried with both concatenating data in single cell with line breaks and splitting data in singl...
- Dec 07, 2022
Strange - when I run your code it does not produce double quotes.
Does this work for you?
Sub SaveRangeAsText() Dim ws As Worksheet Dim f As Integer Dim r As Long Set ws = Worksheets("SHEET") f = FreeFile Open CreateObject("WScript.Shell").SpecialFolders("Desktop") & _ "\FILE\EXEC.scr" For Output As #f For r = 30 To 40 Print #f, ws.Range("W" & r).Value Next r Close #f End Sub
HansVogelaar
Dec 07, 2022MVP
Strange - when I run your code it does not produce double quotes.
Does this work for you?
Sub SaveRangeAsText()
Dim ws As Worksheet
Dim f As Integer
Dim r As Long
Set ws = Worksheets("SHEET")
f = FreeFile
Open CreateObject("WScript.Shell").SpecialFolders("Desktop") & _
"\FILE\EXEC.scr" For Output As #f
For r = 30 To 40
Print #f, ws.Range("W" & r).Value
Next r
Close #f
End Sub- JoAvgDec 07, 2022Brass ContributorWorks like a charm, thank you!
Issue probably has to do with Locale settings since I have to import Greek characters into Autocad.