File does not exist"

sp00kster

New Member
Joined
Nov 25, 2006
Messages
42
Any reason the following code does not find the Excel file? If I force workbook open I get run-time error 1004.
Actual address from address bar = C:\Users\dell\Dropbox\Prefab\Common\Reminder.xlsm. Thanks in advance

VBA Code:
Sub OpenReminders()
    Dim y As Workbook
    Dim Root As String
    Dim sPath As String
    Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
    Root = Left(ThisWorkbook.Path, InStr(1, ThisWorkbook.Path, ":\"))
    sPath = Root & Application.PathSeparator & "Users\del\Dropbox\Prefab\Common\" & "Reminder.xlsm"
    'MsgBox sPath
    If fso.FileExists(sPath) Then 'Testing for existance of reminder.xlsm
        MsgBox "yes does exist"
        Set y = Workbooks.Open(sPath)
    Else
        MsgBox "no does not exist"
    End If
End Sub

I am bad at Excel and this forum saves my but - lol
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Ha....I was just about jump on the typo...?
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top