Vying for the focus - Worksheet Vs Forms

A

Adrian

Hi,

In my VBA program, I have attempted to load 2 modeless forms upon
startup. After which, I wish to return the focus onto the worksheet named
"Sheet1". The code is written as show below:

" Private Sub Workbook_Open()

'Load modeless forms

form1.show 0
form2.show 0

ThisWorkbook.Activate
Sheet1.Activate
ActiveCell.Activate


End Sub

"

However, I was unable to do so and the focus remains at form2. What should I
do to ensure that the focus will stay at the worksheet instead of the forms
?
 
T

Tom Ogilvy

Sub ShowForm()
UserForm1.Show 0
AppActivate Application.Caption
End Sub

worked for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top