gibt es die userform-eigenschaft "showmodal" erst ab excel 9.0
ich habe sie unter excel 8.0(office'97)nicht gefunden.
oder wird sie unter 8.0 anders bezeichnet.
danke
gruß herbert
diese Eigenschaft gibt es in der Tat erst ab Office2000.
Mit folgendem Code kannst Du aber auch in Office97 ein ungebundenes Formular aufrufen. Einfach ins Modul für die Userform kopieren.
Gruß
Axel
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ Private Declare Function SetWindowLong _ Private Declare Function DrawMenuBar Lib "user32" ( _ Private Function fncHasUserformCaption(bState As Boolean) dankePrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
ByVal hwnd As Long) As Long
Dim Userform_hWnd As Long
Dim Userform_Style As Long
Dim Userform_Rect As RECT
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Userform_hWnd = FindWindow( _
lpClassName:=IIf(Val(Application.Version) > 8, _
"ThunderDFrame", "ThunderXFrame"), _
lpWindowName:=Me.Caption)
Userform_Style = GetWindowLong(hwnd:=Userform_hWnd, _
nIndex:=GWL_STYLE)
If bState = True Then
Userform_Style = Userform_Style Or WS_CAPTION
Else
Userform_Style = Userform_Style And Not WS_CAPTION
End If
Call SetWindowLong(hwnd:=Userform_hWnd, nIndex:=GWL_STYLE, _
dwNewLong:=Userform_Style)
Call DrawMenuBar(hwnd:=Userform_hWnd)
End Function
gruß herbert
Private Sub UserForm_Activate() '************************************************Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hwnd As Long) As Long
'###################################################
Private Declare Function EnableWindow Lib "user32" _
(ByVal hwnd As Long, ByVal bEnable As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Call fncHasUserformCaption(False)
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub
Private Function fncHasUserformCaption(bState As Boolean)
Dim Userform_hWnd As Long
Dim Userform_Style As Long
Dim Userform_Rect As RECT
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Userform_hWnd = FindWindow( _
lpClassName:=IIf(Val(Application.Version) > 8, _
"ThunderDFrame", "ThunderXFrame"), _
lpWindowName:=Me.Caption)
Userform_Style = GetWindowLong(hwnd:=Userform_hWnd, _
nIndex:=GWL_STYLE)
If bState = True Then
Userform_Style = Userform_Style Or WS_CAPTION
Else
Userform_Style = Userform_Style And Not WS_CAPTION
End If
Call SetWindowLong(hwnd:=Userform_hWnd, nIndex:=GWL_STYLE, _
dwNewLong:=Userform_Style)
Call DrawMenuBar(hwnd:=Userform_hWnd)
End Function
Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden
Suche nach den besten AntwortenEntdecke unsere meistgeklickten Beiträge in der Google Suche
Top 100 Threads jetzt ansehen