Saving a Backup to the same folder

Throwaway8843

New Member
Joined
Jun 29, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Look I am sure this question has been asked and I have found some close answers online but I am having an issue.

VBA Code:
Sub FileBackUp()

' Saves a backup copy of the excel document in the same folder with the current date and name of the file.

 Dim saveDate As Date
 Dim formatDate As String
 Dim backupFolder As String

    saveDate = Date
   
    formatDate = Format(saveDate, "DD - MM - YYYY")

    Application.DisplayAlerts = False
        backupFolder = ThisWorkbook.Path & "\"
        ActiveWorkbook.SaveCopyAs Filename:=backupFolder & Replace(ActiveWorkbook.Name, ".xlsm", "") & " " & formatDate & ".xlsm"
    Application.DisplayAlerts = True

    MsgBox "Backup Successfully In The Path " & backupFolder

End Sub

When I run this code it saves the backup in the personal workbooks filepath rather than the in the filepath of the current excel I am using. Is there any way to change that while keeping the file location dynamic?
 
So the error message I was receiving before your latest message was "Sorry we couldn't find https://company-my.sharepoint.com/personal/name_company_com/Template 29 - 06 - 2021.xlsm. Is it possible it was moved, renamed or deleted?"

When I run your more recent code no error message or msgbox appears, although I get the microsoft error noise in my headphones. Nothing is saved on my desktop from what I can tell and nothing appears in my immediate window either.
Hang on im just stupid. It reset my shortcut and so it wasnt running.
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
What happens on workbook.open and the full path and name? SOrry, didn't realise this was sharepoint, I haven't used it.

Refresh maybe?
 
Upvote 0
What happens on workbook.open and the full path and name? SOrry, didn't realise this was sharepoint, I haven't used it.

Refresh maybe?
To be honest I didnt know it was sharepoint either. I am not familiar with sharepoint and when I just go to file explorer I just go to This PC > Desktop.

When i try workbooks.open "https://company...blah long file path.xslm" it says it cant find it.

I am trying it on another folder on a shared company wide R: drive as well and get the same thing. It says it saves the excel but nothing is there and workbooks.open cant find it
 
Upvote 0
To be honest I didnt know it was sharepoint either. I am not familiar with sharepoint and when I just go to file explorer I just go to This PC > Desktop.

When i try workbooks.open "https://company...blah long file path.xslm" it says it cant find it.

I am trying it on another folder on a shared company wide R: drive as well and get the same thing. It says it saves the excel but nothing is there and workbooks.open cant find it
I am still absolutely confused why it was working so perfectly and saving a correctly named separate excel when the code was Thisworkbook.path, just in the wrong folder.
 
Upvote 0
What happens on workbook.open and the full path and name? SOrry, didn't realise this was sharepoint, I haven't used it.

Refresh maybe?
The immediate window is propagating with what the correct filepath and name should be
 
Upvote 0
Im just going to mark it as solved with your original comment since it seems to be the sharepoint crap thats messing this up.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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