• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code not saving to sharepoint

Cammandk

Member
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

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"
 
Back
Top