Sharepoint Server wreaking havoc on my macro

Pat_The_Bat

Board Regular
Joined
Jul 12, 2018
Messages
83
I have a macro that creates a folder for every new client we engage with a specific folder structure. It copies a template folder to the desired location, then renames the folder based on the input in the excel workbook I run that macro from.

Sometimes when I open the template, it has an active path of:

https://companyname.sharepoint.com/sites/Team555/Shared Documents

and this causes the macro to bug...

Sometimes the same file opened from the same location has an address of:

C:\Users\myname\company name\Team Shared Documents

Works fine when it has this C local address.
Code:
Sub CreateWinfile()


Dim fsoFSO
Dim bornm As String
Dim path As String
path = Application.ActiveWorkbook.path
path2 = path & "\Brunner - In Process\"
MsgBox (path)






path = Application.ActiveWorkbook.path
Debug.Print path








With Sheets("Cover")
    bornm = Range("L5").Value
    
    End With
    Debug.Print bornm
    
Set fsoFSO = CreateObject("Scripting.FileSystemObject")
If fsoFSO.FolderExists(path2 & bornm) Then
    MsgBox "The WinFile " & bornm & " already exists"
    GoTo Ending
    
Else






'On Error GoTo user2
Set fsoFSO = CreateObject("Scripting.FileSystemObject")
    fsoFSO.CopyFolder path & "\CLIENT WORKBOOK\Z folder Template DO NOT ERASE\ZZZ Template", path2, True
 
Dim FileName As String
Dim NewFileName As String
On Error Resume Next
FileName = path2 & "\ZZZ Template"


NewFileName = path2 & bornm


Any help would be greatly appreciated.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,223,631
Messages
6,173,465
Members
452,516
Latest member
archcalx

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