Sharepoint Server wreaking havoc on my macro

Pat_The_Bat

Board Regular
Joined
Jul 12, 2018
Messages
82
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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

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