Set object1 = ????

  • Thread starter Thread starter BobAchgill
  • Start date Start date
B

BobAchgill

What do I need to put in the ???? to get this code to work?

Dim object1 as object
Set object1 = ????
object1.fileexists()

Thanks!

Bob
 
I think that you're looking at the FileSystemObject

set a reference to Microsoft Scripting Runtime ... to set a reference to a
dll, in the IDE click references under the Tools menu
Example Code:

Sub TestFileExists()
Dim strFile As String
strFile = Application.GetOpenFilename()
MsgBox FileExists(strFile)
End Sub

Function FileExists(strFilename As String) As Boolean
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject

FileExists = fso.FileExists(strFilename)

Set fso = Nothing
End Function

HTH
Patrick Molloy
Microsoft Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top