Error in France, works fine for me...

kevile

New Member
Joined
Dec 8, 2009
Messages
8
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

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
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,222,246
Messages
6,164,802
Members
451,917
Latest member
WEB78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top