Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel97 Userform to be system modal/equivalent
I have done a bit of research online, but it seems that
setsysmodalwindow is not supported in 32bit systems, only 16bit so i can't use that. I am ok with basic coding, but after that i don't have much of a clue so if you could tell me what the code is trying to do rather than what i think it is doing will be a big help. I understand that the xl97 userforms are modal, but you can make use of a bug to make them modeless within the application; but i am wanting the focus brought back to the userform if another application is selected. (Forcing the user to shut down the userform before doing anything else) I want to watch the userform's LostFocus event and use a timer to continually check the form and restore if required. The timer i can probably manage, but the LostFocus has me, well - lost. Very rough coding of what i have so far. (Not sure if hWnd is available in excel97 so i have been struggling with that also) Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal gj As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetActiveWindow Lib "user32" () As Long Private Sub Userform_LostFocus() Dim gj As Long Dim WinSelected as long gj = FindWindow("ThunderXFrame", UserForm1.Caption) WinSelected = GetActiveWindow() On Error Resume Next If Not WinSelected = gj Then SetActiveWindow gj End If End Sub As you can see, i need some serious help. All comments welcome. thanks George |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel97 Userform to be system modal/equivalent
A userform doesn't have a lostfocus event in xl97 to the best of my
knowledge. there is no hwnd property in xl97 -- Regards, Tom Ogilvy "George J" wrote in message ... I have done a bit of research online, but it seems that setsysmodalwindow is not supported in 32bit systems, only 16bit so i can't use that. I am ok with basic coding, but after that i don't have much of a clue so if you could tell me what the code is trying to do rather than what i think it is doing will be a big help. I understand that the xl97 userforms are modal, but you can make use of a bug to make them modeless within the application; but i am wanting the focus brought back to the userform if another application is selected. (Forcing the user to shut down the userform before doing anything else) I want to watch the userform's LostFocus event and use a timer to continually check the form and restore if required. The timer i can probably manage, but the LostFocus has me, well - lost. Very rough coding of what i have so far. (Not sure if hWnd is available in excel97 so i have been struggling with that also) Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal gj As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetActiveWindow Lib "user32" () As Long Private Sub Userform_LostFocus() Dim gj As Long Dim WinSelected as long gj = FindWindow("ThunderXFrame", UserForm1.Caption) WinSelected = GetActiveWindow() On Error Resume Next If Not WinSelected = gj Then SetActiveWindow gj End If End Sub As you can see, i need some serious help. All comments welcome. thanks George |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel97 Userform to be system modal/equivalent
Well that would explain how i couldn't find any info on it
at least. Any suggestions on a way i might be able to do something along these lines?? thanks George -----Original Message----- A userform doesn't have a lostfocus event in xl97 to the best of my knowledge. there is no hwnd property in xl97 -- Regards, Tom Ogilvy "George J" wrote in message ... I have done a bit of research online, but it seems that setsysmodalwindow is not supported in 32bit systems, only 16bit so i can't use that. I am ok with basic coding, but after that i don't have much of a clue so if you could tell me what the code is trying to do rather than what i think it is doing will be a big help. I understand that the xl97 userforms are modal, but you can make use of a bug to make them modeless within the application; but i am wanting the focus brought back to the userform if another application is selected. (Forcing the user to shut down the userform before doing anything else) I want to watch the userform's LostFocus event and use a timer to continually check the form and restore if required. The timer i can probably manage, but the LostFocus has me, well - lost. Very rough coding of what i have so far. (Not sure if hWnd is available in excel97 so i have been struggling with that also) Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal gj As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetActiveWindow Lib "user32" () As Long Private Sub Userform_LostFocus() Dim gj As Long Dim WinSelected as long gj = FindWindow("ThunderXFrame", UserForm1.Caption) WinSelected = GetActiveWindow() On Error Resume Next If Not WinSelected = gj Then SetActiveWindow gj End If End Sub As you can see, i need some serious help. All comments welcome. thanks George . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform modal | Excel Discussion (Misc queries) | |||
Forms that are modal in 97 are not modal in 2003 | Excel Discussion (Misc queries) | |||
Visual Basic System Error-Userform | Excel Discussion (Misc queries) | |||
Equivalent ActiveCell.Id property for Excel97 | Excel Programming | |||
Userform in excel97 not working right! | Excel Programming |