Option 1
The simplest option in your specific case would be to build the save and quit commands into the Excel macro rather than the Outlook one.
That is, you could amend your Outlook code to:
Sub AskMeAlerts()
Dim appExcel As Excel.Application
Dim wkb As Excel.Workbook 'Is this declaration necessary for some code elsewhere? You do not use this variable and I would recommend removing the declaration.
Set appExcel = CreateObject("Excel.Application")
With appExcel
.Workbooks.Open ("C:\Ask me question workflow.xlsm")
.Visible = True
.Run "'Ask me question workflow.xlsm'!AskMeFlow"
'No need to explicitly set alert values or save workbook as Excel macro will handle this.
End With
Set appExcel = Nothing
Set wkb = Nothing 'Again, is this necessary?
End Sub
You could then add the following to the end of the "Ask me question workflow.xlsm" file:
Application.DisplayAlerts = False
ThisWorkbook.Close SaveChanges:=True
Application.Quit
Note: if you will also be running the macro manually or in other use cases where you do not want the workbook to save, close, and quit, you could consider adding an input variable to the AskMeFlow macro that defaults to False but is set to True by Outlook. I think this is slightly outside the scope of this answer, so I will not elaborate further, but let me know if you are interested in this option.
Option 2
Redacted. See Uri's solution; the improvements I suggested do not fundamentally alter that solution.
Option 3
Depending on the nature of the Excel code, you could turn it into a function and capture the output variable. Something like the below:
Sub AskMeAlerts()
Dim appExcel As Excel.Application
Dim wkb As Excel.Workbook
Dim StrOutput as string
StrOutput = "Excel macro did not complete."
Set appExcel = CreateObject("Excel.Application")
appExcel.Workbooks.Open ("C:\Ask me question workflow.xlsm")
appExcel.Visible = True
StrOutput = appExcel.Run "'Ask me question workflow.xlsm'!AskMeFlow"
MsgBox StrOutput
appExcel.DisplayAlerts = False
appExcel.ActiveWorkbook.Save
appExcel.Quit Set appExcel = Nothing
Set wkb = Nothing
End Sub
You would then change AskMeFlow to a function and add the following code:
Function AskMeFlow() as String
AskMeFlow = "Uncaught error executing Excel code."
'Your code here
AskMeFlow = "Excel code completed successfully!"
End Function
{}
button. – Jean-François Corbett