View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
acampbell acampbell is offline
external usenet poster
 
Posts: 20
Default Make form active (set focus)

This should prevent the user from making any changes in the sheet
behind the form until it is closed.

Satish wrote:
Yes, but still the user is select the spreadsheet cells when the form
is shown. How to disable that?

acampbell wrote:
In the userform properties window set ShowModal to TRUE


Satish wrote:
No...actually, I just want the window to be active...

I have seen macros where a form appears on the click of a button
(button is on the spreadsheet), and the user cannot select anything on
the spreadsheet without closing the form. In my case, when the form is
shown to the user, the user can still select cells on the spreadsheet
behind the form.

Something to do with Modal/Modeless?

The way I show the form is UserForm1.Show

I think default is Modeless?

-Satish

wrote:
Sounds like you want to give the user the option to continue data entry
after the "process successful..." message. Try changing the style of
your message box to a yes/no.

Below is a section of code I use in one of my spreadsheets that reacts
to the yes/no response from the user. Just have the yes response loop
back to the form.

Dim Msg, Style, Title2, Help, Ctxt, Response, MyString
Msg = "Starting number entered appears to have been used already.
Continue?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title2 = "Confirm Starting Control Number"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
GoTo Continue2:
Else ' User chose No.
GoTo Handle:
End If
End If


Satish wrote:
Hi all,

This might be probably a very stupid question -

I have a spreadsheet with a command button on one of the sheets. When
the user clicks the button, I show the user a form, where he does his
stuff. When the user clicks a button on the form, I do some processing
and show a message "blah blah done successfully". User clicks OK and
after that, the active window is the Excel spreadsheet and not the
form.

How can I make the form the active window?

Thanks for reading/replying
Satish