ExcelVBAにてメッセージボックスを最前面に表示させる

普通にMsgBoxだと他のウィンドウに隠れちゃったりして不便な時ある。

#If Win64 Then
Public Declare PtrSafe Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hWnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Long) As Long
#Else
Public Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hWnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Long) As Long
#End If

'OKボタンを保有するフラグ
Public Const MB_OK = &H0
'最前面フラグ
Public Const MB_TOPMOST = &H40000

Public Sub FMsgBox(aMess, Optional aCaption = "")
    MessageBox 0, aMess, aCaption, MB_OK Or MB_TOPMOST
End Sub

ネタ元