Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make form active (set focus)

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Make form active (set focus)

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make form active (set focus)

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Make form active (set focus)

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make form active (set focus)

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




  #6   Report Post  
Posted to microsoft.public.excel.programming
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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make form active (set focus)

Yes it does. But the problem is after I show message with a msgbox, I
lose focus on the form and the user can select the spreadsheet behind.

I dont know why that is happening.
Any ideas?

Thanks
Satish

acampbell wrote:
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


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Make form active (set focus)

Any ideas why after displaying a msgbox, the user is able to select
Excel spreadsheet? When the form is shown for the first time, the user
cannot select the spreadsheet. It is only after I display some message
on a msgbox, that the user is able to select the spreadsheet...

Is it some kind of bug??
or I must be doing something wrong? :s

-Satish

Satish wrote:
Yes it does. But the problem is after I show message with a msgbox, I
lose focus on the form and the user can select the spreadsheet behind.

I dont know why that is happening.
Any ideas?

Thanks
Satish

acampbell wrote:
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


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Make form active (set focus)

This code works in XL2K and 2002 and expected - the user cannot interact
with the WS until the userform is dismissed.

<WS code
Private Sub CommandButton1_Click()
UserForm1.Show vbModal
End Sub
</WS code

<Userform code
Private Sub CommandButton1_Click()
MsgBox "Show MsgBox"
End Sub
</Userform code

Unless you have some other code or maybe a RefEdit control (???)

NickHK

"Satish" wrote in message
ups.com...
Any ideas why after displaying a msgbox, the user is able to select
Excel spreadsheet? When the form is shown for the first time, the user
cannot select the spreadsheet. It is only after I display some message
on a msgbox, that the user is able to select the spreadsheet...

Is it some kind of bug??
or I must be doing something wrong? :s

-Satish

Satish wrote:
Yes it does. But the problem is after I show message with a msgbox, I
lose focus on the form and the user can select the spreadsheet behind.

I dont know why that is happening.
Any ideas?

Thanks
Satish

acampbell wrote:
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




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
Active Cell/Focus Rich W. Excel Discussion (Misc queries) 6 March 19th 08 04:59 PM
Repost:Excel not active / loses focus.Pls help! michael.beckinsale Excel Programming 1 August 2nd 06 08:41 AM
Form - Text Box Focus ceemo[_27_] Excel Programming 1 August 30th 05 07:50 PM
set focus on user form jhahes[_2_] Excel Programming 1 June 1st 05 09:26 PM
Form Focus and SelStart Geoff[_9_] Excel Programming 0 April 4th 05 07:20 PM


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