Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Modeless form keeps taking 'focus'

I'm using a modeless form in Excel 2007, I want to be able to scroll around
Excel and occasionally select something from the form. But when I use the
form, the form gets 'focus' and things (like the mouse-wheel) don't apply to
the application anymore.

Is there a way to hand focus back to the application? Or is there a way so
set the form so that it doesn't take this 'focus'?

Thanks

Michelle

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Modeless form keeps taking 'focus'

When you show a modeless userform it takes the focus but after you click to
Excel the form never takes it back on its own. I don't know that you can
avoid the initial taking focus if that's what you mean.

--
Jim
"Michelle" wrote in message
...
| I'm using a modeless form in Excel 2007, I want to be able to scroll
around
| Excel and occasionally select something from the form. But when I use the
| form, the form gets 'focus' and things (like the mouse-wheel) don't apply
to
| the application anymore.
|
| Is there a way to hand focus back to the application? Or is there a way so
| set the form so that it doesn't take this 'focus'?
|
| Thanks
|
| Michelle
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Modeless form keeps taking 'focus'

Maybe you can cheat just a little.

I put this under the userform:

Option Explicit
Private Sub UserForm_Initialize()
Application.OnTime Now + TimeSerial(0, 0, 1), "SelectACell"
End Sub

And this in a general module:
Option Explicit
Sub testme()
UserForm1.Show False
End Sub
Sub SelectACell()
AppActivate Application.Caption
End Sub

It seemed to work ok in my simple testing.


Michelle wrote:

I'm using a modeless form in Excel 2007, I want to be able to scroll around
Excel and occasionally select something from the form. But when I use the
form, the form gets 'focus' and things (like the mouse-wheel) don't apply to
the application anymore.

Is there a way to hand focus back to the application? Or is there a way so
set the form so that it doesn't take this 'focus'?

Thanks

Michelle


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Modeless form keeps taking 'focus'

Cool!

--
Jim
"Dave Peterson" wrote in message
...
| Maybe you can cheat just a little.
|
| I put this under the userform:
|
| Option Explicit
| Private Sub UserForm_Initialize()
| Application.OnTime Now + TimeSerial(0, 0, 1), "SelectACell"
| End Sub
|
| And this in a general module:
| Option Explicit
| Sub testme()
| UserForm1.Show False
| End Sub
| Sub SelectACell()
| AppActivate Application.Caption
| End Sub
|
| It seemed to work ok in my simple testing.
|
|
| Michelle wrote:
|
| I'm using a modeless form in Excel 2007, I want to be able to scroll
around
| Excel and occasionally select something from the form. But when I use
the
| form, the form gets 'focus' and things (like the mouse-wheel) don't
apply to
| the application anymore.
|
| Is there a way to hand focus back to the application? Or is there a way
so
| set the form so that it doesn't take this 'focus'?
|
| Thanks
|
| Michelle
|
| --
|
| Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Modeless form keeps taking 'focus'

OK, thank you, I have taken a while to get it to work because in 2007 the
caption sometimes also includes "[Compatibility Mode]" so it didn't work for
some files, but it does work with:
AppActivate "Microsoft Excel - " & ThisWorkbook.name

Thank you

M


"Dave Peterson" wrote in message
...
Maybe you can cheat just a little.

I put this under the userform:

Option Explicit
Private Sub UserForm_Initialize()
Application.OnTime Now + TimeSerial(0, 0, 1), "SelectACell"
End Sub

And this in a general module:
Option Explicit
Sub testme()
UserForm1.Show False
End Sub
Sub SelectACell()
AppActivate Application.Caption
End Sub

It seemed to work ok in my simple testing.


Michelle wrote:

I'm using a modeless form in Excel 2007, I want to be able to scroll
around
Excel and occasionally select something from the form. But when I use the
form, the form gets 'focus' and things (like the mouse-wheel) don't apply
to
the application anymore.

Is there a way to hand focus back to the application? Or is there a way
so
set the form so that it doesn't take this 'focus'?

Thanks

Michelle


--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Modeless form keeps taking 'focus'

I would have guessed that application.caption would have caught this.

But glad you got it working.

Michelle wrote:

OK, thank you, I have taken a while to get it to work because in 2007 the
caption sometimes also includes "[Compatibility Mode]" so it didn't work for
some files, but it does work with:
AppActivate "Microsoft Excel - " & ThisWorkbook.name

Thank you

M

"Dave Peterson" wrote in message
...
Maybe you can cheat just a little.

I put this under the userform:

Option Explicit
Private Sub UserForm_Initialize()
Application.OnTime Now + TimeSerial(0, 0, 1), "SelectACell"
End Sub

And this in a general module:
Option Explicit
Sub testme()
UserForm1.Show False
End Sub
Sub SelectACell()
AppActivate Application.Caption
End Sub

It seemed to work ok in my simple testing.


Michelle wrote:

I'm using a modeless form in Excel 2007, I want to be able to scroll
around
Excel and occasionally select something from the form. But when I use the
form, the form gets 'focus' and things (like the mouse-wheel) don't apply
to
the application anymore.

Is there a way to hand focus back to the application? Or is there a way
so
set the form so that it doesn't take this 'focus'?

Thanks

Michelle


--

Dave Peterson


--

Dave Peterson
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
Take Focus off a Modeless Userform and onto Worksheet? tc69 Excel Programming 4 March 21st 07 10:04 AM
Focus In Modeless Form (spare me the grief) ThinkImInTrouble Excel Programming 2 July 10th 05 06:21 PM
How do I switch focus from a modeless user form back to the excel. Yoam69 Excel Programming 7 December 7th 04 07:26 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


All times are GMT +1. The time now is 01:24 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"