Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:31:01+00:00 2026-05-28T07:31:01+00:00

FileSystemObject.GetFile() gets a file not found error if you call it on a filename

  • 0

FileSystemObject.GetFile() gets a “file not found” error if you call it on a filename with a single quote/apostrophe in it, ie:

FileSystemObject.GetFile("D:\somepath\some file with an ' apostrophe in it.txt")

Here’s what I’m attempting:

Public Sub VBA_GetFileInfo(FileName As String, ByRef outDateCreated As Date, ByRef outDateAccessed As Date, ByRef outDateModified As Date, ByRef outFileSize As Long)

Dim tmpFile As String
'SOME THINGS I'VE TRIED TO OVERCOME THE PROBLEM, WITH NO SUCCESS:
'tmpFile = """" & FileName & """"
'tmpFile = FileName
'tmpFile = Replace(tmpFile, "\", "\\")
'tmpFile = Replace(tmpFile, "'", "\'")


Dim fso As FileSystemObject
Dim f As file
Dim s As String
Set fso = New FileSystemObject
----> BLOWS UP HERE with "file not found" error:
Set f = fso.GetFile(tmpFile)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:31:02+00:00Added an answer on May 28, 2026 at 7:31 am

    brettdj’s comment:

    As this should be fine are you sure it is an apostrophe – it may be a
    ` rather than ‘

    …turns out to have been the correct answer, it must have been apostrophe’s rather than single quotes causing the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code will read a line from a text file: set file = CreateObject(Scripting.FileSystemObject).OpenTextFile(c:\number.txt,
How would you use FileSystemObject to write to a string to a file in
Using Scripting.FileSystemObject I can get the full path name of a file, but this
I am reading a file using JS like this: var fso = new ActiveXObject(Scripting.FileSystemObject);
am trying to read few lines from a txt file using JS,and i have
I have a file which gets created/modified on a PST machine. But when I
I'm trying to write some Chinese characters to a text file using Set myFSO
Using VBA. My script moves a file into a directory. If that filename already
new ActiveXObject(Scripting.FileSystemObject) this activex works in ie but not in firefox anybodies know the
Using ActiveX - FileSystemObject I would like to: - Open an existing file -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.