What format do I need to prevent quotations marks being exported to a Tab Delimited Text file?

Rhothgar

Board Regular
Joined
Sep 24, 2013
Messages
51
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi

I've tried several formats to try and resolve the following issue. Any advice is greatly appreciated.

I use a text file to upload products to Google Shopping and our website system produces the following "shipping" field.

::Europe:8.00,::Royal Mail 2nd Class Signed For:4.00,::UK Outlying Areas:2.50

I've imported it into latest Excel and when I convert to Tab Delimited Text it exports this:-

"::Europe:8.00,::Royal Mail 2nd Class Signed For:4.00,::UK Outlying Areas:2.50"

This results in Google effectively deleting all our products from their shopping.

I've tried changing format of column to: General, Text and Special but I cannot get my head around the Custom option.

The field length changes and could be:-

::Courier (UK Mainland):0.00,::UPS Next Day Delivery (Zone 1 only):0.00

or even

::Royal Mail 1st Class Signed For:6.55,::Free (Hermes 3 - 5 Working Days):0.00,::Courier (UK Mainland):6.00,::Europe:8.00,::Hermes:0.00,::Royal Mail 2nd Class Signed For:4.00,::Royal Mail 1st Class Signed For (Weight Based):4.55,::UPS Next Day Delivery (Zone 1 only):0.00

It obviously doesn't like the colons but they need to be there.

Is there a way of resolving this issue automatically please?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I have never used a .tsv but I had the same issue with my .csv file. I opened NotePad in my code and then sent a bunch of keys to remove the parentheses.
VBA Code:
    fileToOpen = Application.ActiveWorkbook.FullName
    fileToOpen = Shell("Notepad.exe " & fileToOpen, 1)
    Application.SendKeys "^a", True 'this selects all the text
    Application.SendKeys "^h", True 'this opens the Replace box
    Application.SendKeys "{BACKSPACE}" 'this removes any text in the textbox
    Application.SendKeys """" 'This adds " to remove
    Application.SendKeys "{TAB}"
    Application.SendKeys "{TAB}"
    Application.SendKeys "{TAB}"
    Application.SendKeys "{TAB}"
    Application.SendKeys "{TAB}"
    Application.SendKeys "~" 'This presses enter
    Application.SendKeys "{TAB}"
    Application.SendKeys "~"
    Application.SendKeys "{TAB}"
    Application.SendKeys "~"

Make sure Microsoft Scripting Runtime is checked in your VBA References
Snag_1a111563.png
 
Upvote 0
Sendkeys is a risky approach. Why not just custom write a Sub to write to a .txt file. Code like this does it:

VBA Code:
Sub tsv()
Dim rng As Range
Dim fso As Object, oFile As Object
Dim r As Integer, c As Integer
Dim txt As String
Set rng = Sheet1.Range("A1").CurrentRegion
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFile = fso.CreateTextFile(Environ("TEMP") & "\file.txt")
For r = 1 To rng.Rows.Count
    txt = ""
    For c = 1 To rng.Columns.Count
        If c > 1 Then txt = txt & vbTab
        txt = txt & rng.Cells(r, c).Value2
    Next c
    txt = txt
    oFile.WriteLine txt
Next r
oFile.Close
Set fso = Nothing
Set oFile = Nothing
End Sub

Where the Sheet1 has

Book1
AB
11::Royal Mail 1st Class Signed For:6.55,::Free (Hermes 3 - 5 Working Days):...,::UPS Next Day Delivery (Zone 1 only):0.00
22::Europe:8.00,::Royal Mail 2nd Class Signed For:4.00,::UK Outlying Areas:2.50
Sheet1


Output file to TEMP\file.txt is

1580753043831.png
 
Upvote 0

Forum statistics

Threads
1,215,597
Messages
6,125,741
Members
449,256
Latest member
Gavlaar

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