Hello
Can anyone please help provide a code snippet or alter the below code for a requirement.
In detail: Below code copies a particular tab and uploads/save as in a sharepoint folder. But can I replace the existing file if with the same file name?
Say now I'm trying to save a file name called "Australia" but if there is already a file name called "Australia", that should replace this.
Please help.
Many thanks in advance.
Can anyone please help provide a code snippet or alter the below code for a requirement.
In detail: Below code copies a particular tab and uploads/save as in a sharepoint folder. But can I replace the existing file if with the same file name?
Say now I'm trying to save a file name called "Australia" but if there is already a file name called "Australia", that should replace this.
Code:
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim wb As Workbook
Set wb = Workbooks.Add
ThisWorkbook.Sheets("Reporting").Copy Before:=wb.Sheets(1)
Dim fname As String
Dim FPath As String
'Dim FName1 As String
FPath = "https://microsoft.sharepoint.com/NewFolder/"
fname = Sheets("Reporting").Range("A18").Text
wb.SaveAs Filename:=FPath & "\" & fname
wb.Save
wb.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Please help.
Many thanks in advance.