How do I remove excess quote marks added during exporting workbook as a text document

MPW

Well-known Member
Joined
Oct 7, 2009
Messages
571
Office Version
  1. 365
Platform
  1. Windows
I am looping through a folder of .usx files to modify the content. I thought the easiest would be to load it into a workbook, modify it and then create a new .usx file from the content.
Here is the method of export:
VBA Code:
wb.SaveAs Filename:=sbf & "\" & oFile.Name, FileFormat:=xlCurrentPlatformText
This all works well, however there are additional quote marks added in the process. Hopefully my picture is worth a thousand words... Now I know I can replace these errors in word or notepad, but since I am working through many files it would be nice if it could be added to the automated process. If you need more info let me know. Thanks
1605917977602.png
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello MPW,
I have no too much experience, but I would be glad to help you. Maybe to give you some idea.
Try to use FileSystemObject to write text file instead VBA SaveAs method.
VBA Code:
Option Explicit

Dim fs, a
Sub SaveWithFSO()

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile("C:\Users\testfile.txt", True)
    a.WriteLine (Range("A1"))
    a.Close

End Sub
 
  • Like
Reactions: MPW
Upvote 0
Solution
Thank you Mr. *EXCEL MAX. If you are a Mr.
I was able to adapt your code to my project and it worked nicely. Thank you very much.

Sorry it took me so long to answer, I was eating turkey. Not the country, just the bird. Thanks again.
 
Upvote 0
"Bon appetit".
I'm very glad for your reaction and that you find my idea as solution.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,938
Latest member
Aaliya13

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
Back
Top