View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Activate Excel worksheet after showing a user form ?

Well a quick way to check would be to throw an IF block around your ADO
routines

If False then
' ado routines
End if

and see if it activates. However, I wouldn't expect ADO to cause that
problem, but one never knows.

--
Regards,
Tom Ogilvy

KajBre wrote in message
...
"Tom Ogilvy" kirjoitti viestissä
...
If you actually close the form and are not executing code from the form,
then the visible sheet should be active. That is the normal/default
behavior. Event calling it from a command button, doesn't seem to

affect
this. Not sure how you are causing this problem.

This is a bit strange. I'm using Key Event for activating the sub routine,
which opens the user form like this:
' //
Application.OnKey "{F4}", "AsjaTuoteHaku" '
'..
Sub AsjaTuoteHaku() 'F4 pressed
'...
frmTuotteet.Show 'Show the Form
'.

' // back to the worksheet

Worksheets("Työmääräin").Activate
'..
End Sub

After this the worksheet is updated and visible, but *not* active. In my

VBA
application I can handle this, but I'm just wondering, what is causing

this
problem. Perhaps this has something to do with the ADO routines I'm using
for accessing data in a MS SQL Server database (before showing the user
form) ?

Kaj B.