VBA check for Sharepoint folder exists on one machine, doesn't exist on another (both have access to site)

sous2817

Well-known Member
Joined
Feb 22, 2008
Messages
2,276
Hello everyone,

I'm completely spinning my wheels on this. I've put together some VBA that does everything I need when I run it from my work laptop. When I move the file to my workstation and log in, the code falls over saying the SharePoint path is invalid. Since it's my log in for both machines, the corporate permissions are the same and I can manually access the site from both machines (and confirm that the folder is there).

The simplified code is this:

Code:
Sub test()
    Dim SharePointSite As String
    Dim fso As Scripting.FileSystemObject
    Dim b As Boolean
        
    Set fso = New Scripting.FileSystemObject
    SharePointSite = "\\{SHAREPOINT SITE HERE}"

    b = fso.FolderExists(SharePointSite)
    Debug.Print b
End Sub

This code returns true when I run it from my laptop and false when I run it from my workstation. If I put the sharepoint site in my browser, it takes me there fine on both machines.

Any ideas? Is there some permission somewhere that needs to be set?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I am having the exact same issue.

Rich (BB code):
Dim fso As Scripting.FileSystemObject
Dim LinusDir As Folder

Set fso = New Scripting.FileSystemObject
Set LinusDir = fso.GetFolder("\\{SharepointSite}\")

When I open the sharepoint folders in windows explorer first the code works perfectly, however if I try to run the code without opening the sharepoint first I get 'Run-time error 76 - Path No Found'.

This is fine for me but I need to send this out to other and do not want them to have to do this everytime.

Any help would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,923
Latest member
JackiG

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