Sharepoint Server wreaking havoc on my macro

Pat_The_Bat

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

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Watch MrExcel Video

Forum statistics

Threads
1,099,365
Messages
5,468,191
Members
406,570
Latest member
Ktvu2006

This Week's Hot Topics

Top