Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Take Focus off a Modeless Userform and onto Worksheet?

I've created a Userform that I showed using the xlModeless option to display
some info about the Row that's Active on a Worksheet. I'd like it to be
visible but not have focus kind of like Toolbars. However, it always takes
focus right after I show it. Activating a cell afterwards does not help. I
have to manually click on a cell to take the focus off of it. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Take Focus off a Modeless Userform and onto Worksheet?

Maybe this ?

Private Sub CommandButton1_Click()
UserForm1.Show vbModeless
ActiveCell.Select
End Sub

NickHK

"tc69" wrote in message
...
I've created a Userform that I showed using the xlModeless option to

display
some info about the Row that's Active on a Worksheet. I'd like it to be
visible but not have focus kind of like Toolbars. However, it always

takes
focus right after I show it. Activating a cell afterwards does not help.

I
have to manually click on a cell to take the focus off of it. Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Take Focus off a Modeless Userform and onto Worksheet?

Another one,

Sub test()
UserForm1.Show vbModeless
AppActivate Application.Caption
End Sub

This might not work running from the VBE but should if from a button.

Regards,
Peter T

"tc69" wrote in message
...
I've created a Userform that I showed using the xlModeless option to

display
some info about the Row that's Active on a Worksheet. I'd like it to be
visible but not have focus kind of like Toolbars. However, it always

takes
focus right after I show it. Activating a cell afterwards does not help.

I
have to manually click on a cell to take the focus off of it. Any ideas?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Take Focus off a Modeless Userform and onto Worksheet?

Woo Hoo! Thanks Man! That did it! It works like a dream! It does work
from the VBE. It even works with another Excel session with same Workbook
name open which I was worried about since the Help said "If there is more
than one instance of the application named by title, one instance is
arbitrarily activated."

"Peter T" wrote:

Another one,

Sub test()
UserForm1.Show vbModeless
AppActivate Application.Caption
End Sub

This might not work running from the VBE but should if from a button.

Regards,
Peter T

"tc69" wrote in message
...
I've created a Userform that I showed using the xlModeless option to

display
some info about the Row that's Active on a Worksheet. I'd like it to be
visible but not have focus kind of like Toolbars. However, it always

takes
focus right after I show it. Activating a cell afterwards does not help.

I
have to manually click on a cell to take the focus off of it. Any ideas?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Take Focus off a Modeless Userform and onto Worksheet?

Actually Help is correct and might be an issue in relatively rare scenarios,
eg
- multiple instances with no workbook fully maximized,
- same wb open as Read Only in multiple instances
- some code that changes app captions so all are the same.

Perhaps safer to do something like this

Dim s As String
s = Application.Caption
Application.Caption = s & "unique-string"
AppActivate Application.Caption
Application.Caption = s ' restore previous caption
or
Application.Caption = "" ' reset default caption

Regards,
Peter T


"tc69" wrote in message
...
Woo Hoo! Thanks Man! That did it! It works like a dream! It does work
from the VBE. It even works with another Excel session with same Workbook
name open which I was worried about since the Help said "If there is more
than one instance of the application named by title, one instance is
arbitrarily activated."

"Peter T" wrote:

Another one,

Sub test()
UserForm1.Show vbModeless
AppActivate Application.Caption
End Sub

This might not work running from the VBE but should if from a button.

Regards,
Peter T

"tc69" wrote in message
...
I've created a Userform that I showed using the xlModeless option to

display
some info about the Row that's Active on a Worksheet. I'd like it to

be
visible but not have focus kind of like Toolbars. However, it always

takes
focus right after I show it. Activating a cell afterwards does not

help.
I
have to manually click on a cell to take the focus off of it. Any

ideas?





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
Detecting worksheet change from modeless userform Kent Excel Programming 1 June 27th 06 08:20 PM
Focus In Modeless Form (spare me the grief) ThinkImInTrouble Excel Programming 2 July 10th 05 06:21 PM
Modeless User Form and Worksheet Focus JWolf Excel Programming 2 May 26th 04 08:27 PM
Removing focus from a Modeless Form? Ian Chappel Excel Programming 2 May 1st 04 07:54 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 09:51 AM.

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"