Hi All
I have the following code which creates a backup of the open workbook - this works when on a local machine.
I now have the file on a sharepoint drive and it's not working.
I've already changed the \ to / in the path's but still not registering.
Is it do to with being a URL?
Any help would be much appreciated
I have the following code which creates a backup of the open workbook - this works when on a local machine.
I now have the file on a sharepoint drive and it's not working.
I've already changed the \ to / in the path's but still not registering.
Is it do to with being a URL?
Any help would be much appreciated
Code:
Sub AutoSaveCopyAs()
Dim strBudgetBackupFilePath As StringDim strBudgetBackupFilename As StringDim bytCMActiveNo As Byte
strBudgetBackupFilePath = Sheet6.Range("BudgetBackupFilePath") strBudgetBackupFilename = Sheet6.Range("BudgetBackupFileName") bytCMActiveNo = Sheet6.Range("CMActiveNo")
If bytCMActiveNo = 0 Then
[B]Next line gives error RunTime error “52” – Bad file name or number[/B] If Len(Dir(strBudgetBackupFilePath, vbDirectory)) = 0 Then MkDir (strBudgetBackupFilePath)
End If ThisWorkbook.SaveCopyAs (strBudgetBackupFilePath & strBudgetBackupFilename & " " & Format(Now, "yyyy-mm-dd-hh.mm") & ".xlsm")
End With End Sub
[Code/]
This is the information picked up by the code. The directory is correct.
strBudgetBackupFilePath "https://arrowmedia.sharepoint.com/Production Finance Master/PDavid/Cost Books/BUBackUp/"
strBudgetBackupFilename "BUBK CODEMST V1"