Filename with double quotes in the name

abenitez77

Board Regular
Joined
Dec 30, 2004
Messages
149
I am checking for file size on files before I process them. I am trying to get information on a text file which has double quotes as part of it's name. The path and filename is saved in a table. I get an error msg(error 53: file not found....) and I can't figure out how to get around it. Here is my code:

XLFileFullPath has this value below which I get from a table that has the list of file names:

\\Servername\auditfiles\DealSheet043019_EML_ZIP\4\4786-2306\18-070909 "NEW ITEM SETUP REQUEST" WM D1 Candy 2_met.txt

Code:
'code for FSO:
 Set fso = CreateObject("Scripting.FileSystemObject")
        FileExt = fso.GetExtensionName(XLFileFullPath)
        Set fld = fso.GetFolder(fso.GetParentFolderName(XLFileFullPath))

        Set sMyFile = fso.GetFile(XLFileFullPath)
        FileSz = sMyFile.Size
        If FileSz = 0 Then
            ZeroLen = True
            GoTo FileNotExists
        End If
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I don't use FSO, so this is just a guess. Try adding this line of code at the beginning of the code snippet you showed to us...

XLFileFullPath = Replace(XLFileFullPath, """", """""")
 
Upvote 0
I don't use FSO, so this is just a guess. Try adding this line of code at the beginning of the code snippet you showed to us...

XLFileFullPath = Replace(XLFileFullPath, """", """""")

good try, but it didn't work. I tried putting single quote on both ends but that didn't work either.
 
Upvote 0

Forum statistics

Threads
1,215,055
Messages
6,122,902
Members
449,097
Latest member
dbomb1414

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