Getting a report of "Erreur d'execution '5': Argumen ou appel de procedure incorrect" from a user on French Excel 2010. Running the code on english 2007 and 2010 works fine...
The error occurs when the user clicks our "save/quit" button on the ribbon, is it possible that any of the VBA commands here are named something different in the french version? The error would suggest i'm calling something incorrectly for his version.
Translated error: Execution error '5': Argument or Invalid procedure call
The error occurs when the user clicks our "save/quit" button on the ribbon, is it possible that any of the VBA commands here are named something different in the french version? The error would suggest i'm calling something incorrectly for his version.
Translated error: Execution error '5': Argument or Invalid procedure call
Code:
'This procedure closes the application but calls the save dialog first
Sub btnFileExit_click(control As IRibbonControl)
'suppress default excel prompts
Application.DisplayAlerts = False
'ask if user wants to save, if save is applicable
Dim response As Integer
If modPrimary.Mode <> "r" And ThisWorkbook.Saved = False Then
response = MsgBox("Would you like to save your changes?", vbYesNoCancel, "Save Changes")
Else
response = vbNo
End If
'if no, disregard any changes. if yes, save changes, hide sheets and display message.
If response = vbNo Then
ThisWorkbook.Saved = True
ElseIf response = vbYes Then
'display macro warning and hide sheets
Sheets("Home").lblWarning.Visible = True
modPrimary.HideAllSheets
'protect workbook structure
ThisWorkbook.Protect modPrimary.RecordPassword, True, False
'protect home
Sheets("Home").Protect password:=modPrimary.RecordPassword
'save workbook then quit
ThisWorkbook.Save
Else
're-enable excel prompts
Application.DisplayAlerts = True
Cancel = True
Exit Sub
End If
're-enable application items
With Application
.CellDragAndDrop = True
End With
'disable sheet commands
Application.CommandBars("Ply").FindControl(ID:=847).Enabled = True 'enable delete sheet
Application.CommandBars("Ply").FindControl(ID:=945).Enabled = True 'enable insert worksheet
Application.CommandBars("Ply").FindControl(ID:=889).Enabled = True 'enable rename worksheet
'disable move or copy action
Application.CommandBars("Ply").Controls("&Move or Copy...").Enabled = True
Application.CommandBars("Edit").Controls("&Move or Copy Sheet...").Enabled = True
'enable Ply bar
CommandBars("Ply").Enabled = True
'enable autosave
Application.AutoRecover.Enabled = True
'restore quick keys
Call modPrimary.RestoreHotkeys
'close excel
ThisWorkbook.pClose = True
Application.Quit
End Sub