Hallo Peter,
ein Beispiel. Bleibt nur die Frage, ob der Aufwand zu rechtfertigen ist.
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare Function FindWindowA Lib "user32.dll" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimer As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function MessageBoxA Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal wType As Long) As Long
Private Declare Function SendDlgItemMessageA Lib "user32.dll" ( _
ByVal hDlg As Long, _
ByVal nIDDlgItem As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Const TIMER_ID = 0
Private Const TIMER_ELAPSE = 25
Private Const WM_SETTEXT = &HC
Private Const GC_CLASSNAMEMSEXCEL = "XLMAIN"
Private Const GC_CLASSNAMEMSDIALOGS = "#32770"
Private lstrButtonCaption1 As String
Private lstrButtonCaption2 As String
Private lstrButtonCaption3 As String
Private lstrBoxTitel As String
Private llngXL_hWnd As Long
Private Function MsgBoxPlus( _
ByVal strText As String, _
ByVal strTitle As String, _
ByVal strButtobText1 As String, _
Optional ByVal strButtobText2 As String, _
Optional ByVal strButtobText3 As String, _
Optional ByVal enmStyle As VbMsgBoxStyle) As Long
Dim lngResult As Long
lstrButtonCaption1 = strButtobText1
lstrButtonCaption2 = strButtobText2
lstrButtonCaption3 = strButtobText3
lstrBoxTitel = strTitle
llngXL_hWnd = FindWindowA(GC_CLASSNAMEMSEXCEL, Application.Caption)
Call SetTimer(llngXL_hWnd, TIMER_ID, TIMER_ELAPSE, AddressOf MsgBoxPlus_TimerEvent)
If strButtobText2 = "" And strButtobText3 = "" Then
lngResult = MessageBoxA(llngXL_hWnd, strText, strTitle, enmStyle Or vbOKOnly)
ElseIf strButtobText2 <> "" And strButtobText3 = "" Then
lngResult = MessageBoxA(llngXL_hWnd, strText, strTitle, enmStyle Or vbYesNo)
Else
lngResult = MessageBoxA(llngXL_hWnd, strText, strTitle, enmStyle Or vbAbortRetryIgnore)
End If
If lngResult = 1 Or lngResult = 3 Or lngResult = 6 Then
MsgBoxPlus = 1
ElseIf lngResult = 4 Or lngResult = 7 Then
MsgBoxPlus = 2
Else
MsgBoxPlus = 3
End If
End Function
Private Sub MsgBoxPlus_TimerEvent(ByVal hWnd As Long)
Dim lngBox_hWnd As Long
Call KillTimer(llngXL_hWnd, TIMER_ID)
lngBox_hWnd = FindWindowA(GC_CLASSNAMEMSDIALOGS, lstrBoxTitel)
If lstrButtonCaption2 = "" And lstrButtonCaption3 = "" Then
Call SendDlgItemMessageA(lngBox_hWnd, vbCancel, WM_SETTEXT, 0&, lstrButtonCaption1)
ElseIf lstrButtonCaption2 <> "" And lstrButtonCaption3 = "" Then
Call SendDlgItemMessageA(lngBox_hWnd, vbYes, WM_SETTEXT, 0&, lstrButtonCaption1)
Call SendDlgItemMessageA(lngBox_hWnd, vbNo, WM_SETTEXT, 0&, lstrButtonCaption2)
Else
Call SendDlgItemMessageA(lngBox_hWnd, vbAbort, WM_SETTEXT, 0&, lstrButtonCaption1)
Call SendDlgItemMessageA(lngBox_hWnd, vbRetry, WM_SETTEXT, 0&, lstrButtonCaption2)
Call SendDlgItemMessageA(lngBox_hWnd, vbIgnore, WM_SETTEXT, 0&, lstrButtonCaption3)
End If
End Sub
Public Sub Aufruf()
Select Case MsgBoxPlus("Erklärung", "EntwederOder", "Entweder", "Oder", , vbCritical Or vbDefaultButton2)
Case 1
MsgBox "Entweder"
Case 2
MsgBox "Oder"
Case 3
MsgBox "?"
End Select
End Sub
Gruß
Nepumuk