(Solved) – Error 1004: SaveAs Method Failed, accessMode:=xlShared

(solved)-–-error-1004:-saveas-method-failed,-accessmode:=xlshared

I have a problem with a macro.

”’

Sub ActivePartage()

Dim Destwb As Workbook
Dim TempFile As String
Dim FileExtStr As String
Dim FileFormat As Integer
Set Destwb = ActiveWorkbook

strTestString = Left(Destwb.Name, (InStrRev(Destwb.Name, ".", -1, vbTextCompare) - 1))

FileExtStr = ".xlsm": FileFormatNum = 52
TempFile = "H:DQMTableau de Bord DQM" & strTestString

Application.DisplayAlerts = False
With Destwb
    .SaveAs TempFile & FileExtStr, FileFormat:=FileFormatNum, AccessMode:=xlShared
End With
Application.DisplayAlerts = True

End Sub

”’
I tried to figure it out why there is an error (filenamen format…etc)
I know it’s working without AccessMode:=xlShared, but I need to save it as shared mode.
I am using Excel 2016, my code has been inspired from this link:
https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.multiuserediting

Could someone help me please?

Leave a Reply

Your email address will not be published. Required fields are marked *