Forum Discussion

JoAvg's avatar
JoAvg
Brass Contributor
Dec 07, 2022
Solved

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...
  • HansVogelaar's avatar
    Dec 07, 2022

    JoAvg 

    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