Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 04-26-2021, 03:35 AM
p45cal's Avatar
p45cal p45cal is offline Excel/VBS DIM MyFSO error Windows 10 Excel/VBS DIM MyFSO error Office 2019
Expert
 
Join Date: Apr 2014
Posts: 962
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

If this is only for that little macro it's probably not worth adding the reference to the project, use late binding instead:
Code:
Sub CheckFileExist()
Dim MyFSO As Object
Set MyFSO = CreateObject("Scripting.FileSystemObject")
If MyFSO.FileExists("C:\temp\text.txt") Then
  MsgBox "The File Exists"
Else
  MsgBox "The File Does Not Exist"
End If
End Sub
but perhaps easier:
Code:
Sub CheckFileExist2()
If Dir("C:\temp\text.txt") = "" Then
  MsgBox "The File Does Not Exist"
Else
  MsgBox "The File Does Exist"
End If
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel runtime error 48; error in loading dll mwittman5 Excel Programming 0 01-19-2017 05:18 PM
Embeding Excel Docs in Word - Receiving Memory Error Message if Excel is open kdash Word 0 05-06-2015 09:38 AM
Excel error window: Excel has stopped working MunganBrus Excel 1 01-13-2015 11:19 AM
Excel/VBS DIM MyFSO error Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM
Excel/VBS DIM MyFSO error Open Word w Excel & fill Word textboxes w info from Excel fields runtime error 4248 Joe Patrick Word VBA 2 01-30-2012 07:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft