Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50068

Runtime-error '1004' cannot access the file, depending on the computer

$
0
0
Hi all,

The context:
I have an Excel file on a SharePoint server.
People can open it, edit it, save it.
When they save it, there is a macro to save a copy on the network (public drive), and replace the previous copy if it exists :

Code:

Private Sub Workbook_BeforeSave()
   
    Dim FName          As String
    Dim FPath          As String
     
    FPath = "P:\Back Up"
    FName = Sheet1.Range("B1").Text
    ThisWorkbook.SaveCopyAs Filename:=FPath & "\" & FName & " Back Up" & ".xlsm"
 
End Sub

The problem:
If I do it from my computer, it always works.
But for some people, I always get this error :

Code:

Runtime-error '1004'
Excel cannot access the file. Possible reasons :
- File name or path does not exist
- File is being used by another program
- Workbook as the same name as a currently open workbook

The file is saved on SharePoint but the copy is not saved.

----

I did some researches but did not find anything.

Viewing all articles
Browse latest Browse all 50068

Trending Articles