Live-Forum - Die aktuellen Beiträge
Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

MsgBox verschieben ?

Forumthread: MsgBox verschieben ?

MsgBox verschieben ?
12.09.2006 16:38:19
michael
NachmittagsGruß ins Forum.
Kann man die MsgBox gleich wie die InputBox verschieben ?
vom Zentrum ca.2 Standartspalten nach rechts
Wenn ja bitte wie !
Danke michael
Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: MsgBox verschieben ?
12.09.2006 17:19:13
Nepumuk
Hallo Michael,
da kenne ich mehrere Varianten. Die von mir bevorzugte:
' **********************************************************************
' Modul: Modul3 Typ: Allgemeines Modul
' **********************************************************************

Option Explicit

Private Declare Function GetVbaProjekt Lib "vba332.dll" Alias "EbGetExecutingProj" ( _
    ByRef hVBA As Long) As Long
Private Declare Function SetWindowPos Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal hWndInsertAfter As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal cx As Long, _
    ByVal cy As Long, _
    ByVal wFlags As Long) As Long
Private Declare Function SetWindowsHookEx Lib "user32.dll" Alias "SetWindowsHookExA" ( _
    ByVal idHook As Long, _
    ByVal lpfn As Long, _
    ByVal hmod As Long, _
    ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32.dll" ( _
    ByVal hHook As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32.dll" () As Long

Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOACTIVATE = &H10
Private Const HCBT_ACTIVATE = 5
Private Const WH_CBT = 5

Private hHook As Long
Private Const posX = 100&
Private Const posY = 100&

Private Function WinProc(ByVal lMsg As Long, ByVal wParam _
        As Long, ByVal lParam As Long) As Long

    If lMsg = HCBT_ACTIVATE Then
        SetWindowPos wParam, 0, posX, posY, 0, 0, SWP_NOSIZE Or _
            SWP_NOZORDER Or SWP_NOACTIVATE
        UnhookWindowsHookEx hHook
    End If
    WinProc = False
End Function

Public Sub prcShowBox3()
    Dim hInst As Long, Thread As Long
    GetVbaProjekt hInst
    Thread = GetCurrentThreadId()
    hHook = SetWindowsHookEx(WH_CBT, AddressOf WinProc, _
        hInst, Thread)
    MsgBox "Hallo, da bin ich", 64, "Information"
End Sub

Gruß
Nepumuk
Anzeige
AW: MsgBox verschieben ?
12.09.2006 19:25:39
Holger
Hi,
Fehler, DLL "vba332.dll" nicht gefunden:
Gibt es auch eine Lösung, die unter XP, Excel 2003 funktioniert?
mfg Holger
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige