Hi Steve,
That is true, I use magic forms as you call them
I do UserForm1.Show
instead of doing that :
Dim MyForm as UserForm1
Set MyForm = New UserForm1
blah
Set MyForm = Nothing
The practical thing with magical forms is that i can keep the values o
the textboxes that can be edited again in he formfields in memory whe
I do a cancel action on my buttons, if you know that I mean
If I do a new Userform, I loose my values
what should i do to avoid that ?
Hope this is clear
--------------------------------------------------------------------
It seems that I found the problem but I'm not sure
let me try to explain
I have two userforms : the first one is called by a macro and th
second one is called by a button on the first userform, hope you'r
still with me (lol). On the second form, I have a cancel button tha
recalls the first userform by a userform2.hide and a userform1.show
I had this code below to prevent the user to close the userforms by th
cross and to force him to use the buttons of my forms :
Private Declare Function _
GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function _
GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare Function _
DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As Long
Private Declare Function _
RemoveMenu Lib "user32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function _
GetActiveWindow Lib _
"user32" () As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
and in the Activate method, I put the code below :
'Gestion de la croix
Dim hSysMenu As Long
Dim nCnt As Long
Dim lWin
lWin = GetActiveWindow()
hSysMenu = GetSystemMenu(lWin, False)
'Stop
If hSysMenu Then
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
RemoveMenu hSysMenu, nCnt - 1, _
MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, _
MF_BYPOSITION Or MF_REMOVE
DrawMenuBar lWin
End If
End If
When I was clicking on the cancel button of the userform2 to recall th
userform1, I couldn't move the userform1 with the mouse
I erased from the userform1, the code I put below and it seems to work
but I'm not sure
do you have an explanation about that?
Thanx
Lyn