Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default modeless userform

Hi,
With a modeless userform, is it possible to detect its
state via VBA, i.e. if it has focus or not?

What is client coordinates?

Any help appreciated.

jacob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default modeless userform

This sub returns the caption of the userform, or of Excel, depending on
which is the active window:

Declare Function GetActiveWindow32 Lib "user32" Alias _
"GetActiveWindow" () As Integer

Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Private Const BUFFER_LEN As Long = 254

Sub ShowActiveWindow()
Dim RetLen As Long
Dim sBuffer As String * BUFFER_LEN
RetLen = GetWindowText(GetActiveWindow32, sBuffer, BUFFER_LEN)
If RetLen 0 Then MsgBox Left(sBuffer, RetLen)
End Sub

--
Jim Rech
Excel MVP
"jacob" wrote in message
...
| Hi,
| With a modeless userform, is it possible to detect its
| state via VBA, i.e. if it has focus or not?
|
| What is client coordinates?
|
| Any help appreciated.
|
| jacob


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
Modeless userform hngo New Users to Excel 2 July 13th 05 09:23 AM
Can RefEdit Contrl be Used on a Modeless Userform? Jerry Louis Excel Programming 3 April 20th 04 12:56 PM
Modeless userform jacob[_3_] Excel Programming 2 September 29th 03 08:02 PM
Disable close button of Modeless Userform RB Smissaert Excel Programming 2 September 13th 03 09:46 PM
Focus back from modeless userform to sheet RB Smissaert Excel Programming 4 September 5th 03 04:21 PM


All times are GMT +1. The time now is 10:06 PM.

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

About Us

"It's about Microsoft Excel"