ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set object1 = ???? (https://www.excelbanter.com/excel-programming/323498-set-object1-%3D.html)

BobAchgill

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

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

Thanks!

Bob



Patrick Molloy[_2_]

Set object1 = ????
 
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

"BobAchgill" wrote:

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

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

Thanks!

Bob





All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com