Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
800to804
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
800to804
800to804
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Userform Minimieren

Userform Minimieren
15.09.2006 12:21:42
Heinz
Hallo Leute
Habe eine UserForm1.
Nun möchte ich wenn ich auf ein anderes Tab.Blatt im Tabellenreiter klicke,das die Userform minimiert unten abgelegt wird.
Momentan muss ich mit der Maus die UserForm1 minimieren.
Könnte mir da Bitte jemand weiterhelfen ?
Danke, Heinz

7
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Userform Minimieren
15.09.2006 13:14:42
otto
Hi, w
ie minimierst du die UF mit der Maus? Geht das?
Gruß otto
AW: Userform Minimieren
15.09.2006 13:22:55
Heinz
Hallo Otto
Ja das geht.
Hat mir ein Kollege gemacht. Konntest es selbst auch nicht.
Wenn Du möchtest könnte ich dir die Datei zukommen lassen. (ca.1 Mb gross)
Gruss, Heinz
AW: Userform Minimieren
15.09.2006 13:49:16
Reinhard
Hi Heinz,
nicht perfekt aber funktioniert, entsprechende Call-Aufrufe in Worksheet_Activate der Tabellenblätter.
Mir fällt grad ein mit Visible müßte es auch gehen.
Option Explicit
Dim t, h, l, w
Sub tt()
UserForm1.Show 0
End Sub
Sub klein()
t = UserForm1.Top
l = UserForm1.Left
h = UserForm1.Height
w = UserForm1.Width
UserForm1.Top = 0
UserForm1.Left = 0
UserForm1.Height = 0
UserForm1.Width = 0
End Sub
Sub gross()
UserForm1.Top = t
UserForm1.Left = l
UserForm1.Height = h
UserForm1.Width = w
End Sub

Gruß
Reinhard
ps: Ich freue mich über eine Rückmeldung ob diese Antwort hilfreich war oder nicht..
Anzeige
AW: Userform Minimieren
15.09.2006 17:01:13
Hubert
Hi,
das bekommst du mit deinen Kenntnissen nicht gebacken, setzt genaue Kenntnisse der
API voraus, es sei denn, jemand integriert das in deine Mappe.
mfg Hubert
AW: Userform Minimieren
16.09.2006 09:33:32
Reinhard
Moin Josef,
unsre beiden Codes trennen Klassenwelten :-) aber in der Auswirkung sind sie gleich, die UF ist wech. Wenn man aber die UF manuell minimiert ist sie unten noch ansprechbar sichtbar und ich habe den Anfrager so verstanden dass er genau das will, sonst könnte er ja gleich unload o.ä. benutzen.
Gruß
Reinhard
Anzeige
An Josef & Rainhard
16.09.2006 11:04:40
Heinz
Hallo Josef & Rainhard
Dieser Code ist in der Mappe schon eingefügt.
Hoffe das dies der richtige Code ist.
Könntet Ihr mir Bitte den Code abändern ?
Muss nun auf eine Hochzeit gehen.
Kann erst morgen nachsehen.
Danke an Euch beiden & schönes WE.
Gruss,Heinz
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const WS_BORDER = &H800000
Const WS_CAPTION = &HC00000
Const WS_CHILD = &H40000000
Const WS_HSCROLL = &H100000
Const WS_MAXIMIZE = &H10000000
Const WS_MAXIMIZEBOX = &H10000
Const WS_MINIMIZEBOX = &H20000
Const WS_THICKFRAME = &H40000
Const WS_SIZEBOX = WS_THICKFRAME
Const WS_SYSMENU = &H80000
Const WS_EX_ACCEPTFILES = &H10
Const WS_EX_STATICEDGE = &H20000
Const WS_EX_TOOLWINDOW = &H80
Const WS_EX_TRANSPARENT = &H20
Const WS_EX_WINDOWEDGE = &H100
Const GWL_STYLE = (-16)
Const GWL_EXSTYLE = (-20)
Dim WithEvents myUserForm As MSForms.UserForm
Dim myHandle&, lStyle&, Border&
Dim MaxBox As Boolean, MinBox As Boolean
Public Enum BorderStyles
xlFest = 0
xlÄnderbar = 1
End Enum
Public Sub Create(UF As MSForms.UserForm)
Dim ret&
Set myUserForm = UF
myHandle = GetHandle
SetWindowLong myHandle, GWL_STYLE, GetStyle Or WS_CAPTION Or Border
If MaxBox Then SetWindowLong myHandle, GWL_STYLE, GetStyle Or WS_MAXIMIZEBOX
If MinBox Then SetWindowLong myHandle, GWL_STYLE, GetStyle Or WS_MINIMIZEBOX
SetWindowLong myHandle, GWL_EXSTYLE, GetStyle And WS_EX_STATICEDGE And WS_EX_WINDOWEDGE
End Sub

Private Function GetHandle() As Long
Select Case Int(Val(Application.Version))
Case 8 'Excel 97
GetHandle = FindWindow("ThunderXFrame", vbNullString)
Case 9 'Excel 2000
GetHandle = FindWindow("ThunderDFrame", vbNullString)
Case 10 'Excel XP
GetHandle = FindWindow("ThunderDFrame", vbNullString)
Case 11 'Excel 2003
GetHandle = FindWindow("ThunderDFrame", vbNullString)
End Select
End Function

Public Property Get hwnd() As Boolean
hwnd = myHandle
End Property
Public Property Get MaxButton() As Boolean
MaxButton = MaxBox
End Property
Public Property Let MaxButton(Status As Boolean)
MaxBox = Status
End Property
Public Property Get MinButton() As Boolean
MinButton = MinBox
End Property
Public Property Let MinButton(Status As Boolean)
MinBox = Status
End Property
Public Property Let BorderStyle(Style As BorderStyles)
Select Case Style
Case 0: Border = 0
Case 1: Border = WS_SIZEBOX
End Select
End Property

Private Function GetStyle() As Long
GetStyle = GetWindowLong(myHandle, GWL_STYLE)
End Function


Private Sub Class_Initialize()
MaxBox = False
MinBox = False
End Sub

Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige