Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform modal Dave K[_3_] Excel Discussion (Misc queries) 1 April 9th 10 07:41 AM
Forms that are modal in 97 are not modal in 2003 Old Car Excel Discussion (Misc queries) 1 April 27th 05 08:25 AM
Visual Basic System Error-Userform GENEF Excel Discussion (Misc queries) 1 December 22nd 04 05:05 PM
Equivalent ActiveCell.Id property for Excel97 Rick De Marco Excel Programming 1 June 18th 04 02:28 PM
Userform in excel97 not working right! Simon Lloyd[_485_] Excel Programming 3 June 15th 04 03:53 PM


All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"