I'm using the following sub:
Sub Security()
    Dim secAutomation As MsoAutomationSecurity

    secAutomation = Application.AutomationSecurity

    Application.AutomationSecurity = msoAutomationSecurityForceDisable
    With Application.FileDialog(msoFileDialogOpen)
        .Show
        Workbooks.Open .SelectedItems(1)
    End With
    Application.AutomationSecurity = secAutomation
End Sub
On some files: it opens the file but ends the macro immediately, leaving AutomationSecurity set to msoAutomationSecurityForceDisable.

But not all files.
Some files it opens fine.

Is there some way to determine what it is about a file that is causing the macro to end?