Hallo Forummers,
Ik heb de volgende vraag.
Ik ben sinds kort gedwongen om op een powerbook G4 mijn werk buitens huis te doen.
Ik heb op de powerbook de office versie 2004 for mac staan.
Dit werk heel goed, maar er een probleempje met sommige vba taal.
Zo heb ik ooit een funtie van het internet afgehaald om het sluitkruisje op userforms te verbergen, hier volgt de code die je zo in een module kan plakken om te testen:
Option Explicit
'Find the Dialog's Window
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'Get the current window style
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'Set the new window style
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const WS_SYSMENU = &H80000
Const GWL_STYLE = (-16)
Dim hWndForm As Long
'Routine to hide the close button on a userform or dialogsheet
Sub NoCloseButton(oForm As Object)
Dim hwnd As Long, lStyle As Long
If Val(Application.Version) < 9 Then
hWndForm = FindWindow("ThunderXFrame", oForm.Caption) 'XL97
Else
hWndForm = FindWindow("ThunderDFrame", oForm.Caption) 'XL2000
End If
'Get the current window style
lStyle = GetWindowLong(hWndForm, GWL_STYLE)
'Turn off the System Menu bit
SetWindowLong hWndForm, GWL_STYLE, lStyle And Not WS_SYSMENU
End Sub
Zoals je ziet, moet je in de UserForm_Initialize, de kreet zetten: NoCloseButton Me.
Hierdoor zal het sluitkruisje verdwijnen.
Nu zou ik dit ook graag op mijn powerbook hebben, maar ik krijg een foutmelding dat user32 niet gevonden kan worden, ik kan mij dat voorstellen omdat mac heel anders in elkaar zit als windows.
Dus wie kan mij helpen om deze code aan te passen dat ie ook voor Mac office 2004 werkt.
Alvast bedankt
Gr Dennis
Ik heb de volgende vraag.
Ik ben sinds kort gedwongen om op een powerbook G4 mijn werk buitens huis te doen.
Ik heb op de powerbook de office versie 2004 for mac staan.
Dit werk heel goed, maar er een probleempje met sommige vba taal.
Zo heb ik ooit een funtie van het internet afgehaald om het sluitkruisje op userforms te verbergen, hier volgt de code die je zo in een module kan plakken om te testen:
Option Explicit
'Find the Dialog's Window
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'Get the current window style
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'Set the new window style
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const WS_SYSMENU = &H80000
Const GWL_STYLE = (-16)
Dim hWndForm As Long
'Routine to hide the close button on a userform or dialogsheet
Sub NoCloseButton(oForm As Object)
Dim hwnd As Long, lStyle As Long
If Val(Application.Version) < 9 Then
hWndForm = FindWindow("ThunderXFrame", oForm.Caption) 'XL97
Else
hWndForm = FindWindow("ThunderDFrame", oForm.Caption) 'XL2000
End If
'Get the current window style
lStyle = GetWindowLong(hWndForm, GWL_STYLE)
'Turn off the System Menu bit
SetWindowLong hWndForm, GWL_STYLE, lStyle And Not WS_SYSMENU
End Sub
Zoals je ziet, moet je in de UserForm_Initialize, de kreet zetten: NoCloseButton Me.
Hierdoor zal het sluitkruisje verdwijnen.
Nu zou ik dit ook graag op mijn powerbook hebben, maar ik krijg een foutmelding dat user32 niet gevonden kan worden, ik kan mij dat voorstellen omdat mac heel anders in elkaar zit als windows.
Dus wie kan mij helpen om deze code aan te passen dat ie ook voor Mac office 2004 werkt.
Alvast bedankt
Gr Dennis