View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default How do I switch focus from a modeless user form back to the excel.

I found that that doesn't always work.
For example:

With MainForm 'the modeless userform
.Height = 32
.Width = 40
.Left = 30
.Top = 30
End With

AppActivate Application.Caption

It looks as if Excel has the focus, but for example pressing the arrow keys
doesn't change the selected cell.


RBS



"Tom Ogilvy" wrote in message
...
Anoter possibility is to use appactivate:

An example:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$C$3" Then
UserForm1.Show vbModeless
AppActivate Application.Caption
End If
End Sub


--
Regards,
Tom Ogilvy



"Yoam69" wrote in message
...
When I call a modeless user form, I want to then switch the focus back to

the
excel window that was active when the form was called, but leave the form
active (but not with the focus). Nothing I've tried has worked so far.