Search code examples
vbafilesystemobject

trouble with using filesystemobject in vba


I'm having trouble using filesystemobject in a vba function I am writing. I keeping getting the error: Runtime error 424 Object required

I have found lots of stuff online but none of it has done any good. Yes I have checked the References and Microsoft Scripting Runtime is checked. Here is as snippet of code please tell me what I am doing wrong. I have tried changing the first line to Dim objFSO as New FileSystemObject among other things but they are produce the same error. The error occurs on the second line.

Dim objFSO
Set objFSO = CreateObject(”Scripting.FileSystemObject”)

Solution

  • You are using odd quotes, use plain quotes.

    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")