Thread: [Solved] Excel/VBS DIM MyFSO error
View Single Post
 
Old 04-21-2021, 09:02 AM
OldGuy1949 OldGuy1949 is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2021
Posts: 3
OldGuy1949 is on a distinguished road
Default Excel/VBS DIM MyFSO error

Can someone tell me why I get this error?
It will run from excel/vbs macro but not a standalone from 'Send To' menu.

Sub Add_Reference()
Application.VBE.ActiveVBProject.References.AddFrom File "C:\Windows\System32\scrrun.dll"
'Add a reference
End Sub

Sub CheckFileExist()
Dim MyFSO As FileSystemObject
Set MyFSO = New FileSystemObject
If MyFSO.FileExists("C:\temp\text.txt") Then
MsgBox "The File Exists"
Else
MsgBox "The File Does Not Exist"
End If
End Sub

'error line 9 char 12 ; expected end of statement
'code 800A0401
Reply With Quote