Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default User Form focus

I have a user form that contains options that will be place in the selected
cell. It works fine in modal status. However, I wanted to make the form
non-modal so the user could select more than one cell to insert the data so
they would not have to repeat the action several times.

Here is the problem. When I set the form non-modal, the focus remains in
the cell awaiting input. I cannot select the form. However, I can move the
cursor to another cell and then back and then select the form. I tried to
set the focus to the form or an object in the form (like the OK button).

Have I missed something? I want to run the form non-modal and have the
focus on the form when it is envoked. Is that possible?

Glen


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default User Form focus


Just a guess..

is the form called from a button on a sheet?
(from the controls Toolbox)..

check the button's properties..
ensure that "TakeFocusOnClick" is disabled.

or.. in the macro that calls the form,
activecell.activate
userform1.show vbModeless






keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Glen Mettler" wrote:

I have a user form that contains options that will be place in the
selected cell. It works fine in modal status. However, I wanted to
make the form non-modal so the user could select more than one cell to
insert the data so they would not have to repeat the action several
times.

Here is the problem. When I set the form non-modal, the focus remains
in the cell awaiting input. I cannot select the form. However, I can
move the cursor to another cell and then back and then select the
form. I tried to set the focus to the form or an object in the form
(like the OK button).

Have I missed something? I want to run the form non-modal and have
the focus on the form when it is envoked. Is that possible?

Glen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default User Form focus

The form is called from a doubleclick in the cell. I have code in the
SheetBeforeDoubleClick event for the workbook. The code captures the
column. Then a series of If statements call the form if the column matches:
for example:
If sCol = Range("Dist_Modl").Value Then
pRow = Selection.Row
EACTcol = Range("EACT").Value
hrscol = Range("Dist_Modl").Value
If Cells(pRow, EACTcol).Value = "T" Or Cells(pRow, EACTcol).Value =
"L" Then
HoursDistribution.Show
End If
'Cells(ActiveCell.Row + 1, sCol).Select
End If

note that the last code statement of the major If statement
(Cells(ActiveCell.row...) is commented. If I uncomment this statment, the
form works as I want it to but it cell is now on the next row. I want the
focus to remain on the cell selected. If I comment the code, the focus
remains in the cell waiting for user input and does not go to the form.

I tried KeepITcool's code and it didn't change anything.

There should be a way to do this.

Glen

"Glen Mettler" wrote in message
...
I have a user form that contains options that will be place in the selected
cell. It works fine in modal status. However, I wanted to make the form
non-modal so the user could select more than one cell to insert the data so
they would not have to repeat the action several times.

Here is the problem. When I set the form non-modal, the focus remains in
the cell awaiting input. I cannot select the form. However, I can move
the cursor to another cell and then back and then select the form. I
tried to set the focus to the form or an object in the form (like the OK
button).

Have I missed something? I want to run the form non-modal and have the
focus on the form when it is envoked. Is that possible?

Glen



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default User Form focus

replace the commented line with

Cancel = True

--
Regards,
Tom Ogilvy

"Glen Mettler" wrote in message
...
The form is called from a doubleclick in the cell. I have code in the
SheetBeforeDoubleClick event for the workbook. The code captures the
column. Then a series of If statements call the form if the column

matches:
for example:
If sCol = Range("Dist_Modl").Value Then
pRow = Selection.Row
EACTcol = Range("EACT").Value
hrscol = Range("Dist_Modl").Value
If Cells(pRow, EACTcol).Value = "T" Or Cells(pRow, EACTcol).Value

=
"L" Then
HoursDistribution.Show
End If
'Cells(ActiveCell.Row + 1, sCol).Select
End If

note that the last code statement of the major If statement
(Cells(ActiveCell.row...) is commented. If I uncomment this statment, the
form works as I want it to but it cell is now on the next row. I want the
focus to remain on the cell selected. If I comment the code, the focus
remains in the cell waiting for user input and does not go to the form.

I tried KeepITcool's code and it didn't change anything.

There should be a way to do this.

Glen

"Glen Mettler" wrote in message
...
I have a user form that contains options that will be place in the

selected
cell. It works fine in modal status. However, I wanted to make the form
non-modal so the user could select more than one cell to insert the data

so
they would not have to repeat the action several times.

Here is the problem. When I set the form non-modal, the focus remains

in
the cell awaiting input. I cannot select the form. However, I can move
the cursor to another cell and then back and then select the form. I
tried to set the focus to the form or an object in the form (like the OK
button).

Have I missed something? I want to run the form non-modal and have the
focus on the form when it is envoked. Is that possible?

Glen





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
Modeless User Form and Worksheet Focus JWolf Excel Programming 2 May 26th 04 08:27 PM
Sending Form Focus? Clint K. Excel Programming 0 May 23rd 04 03:16 AM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM
How to set focus back to sheet after showing a user form Stephen Bullen Excel Programming 0 July 22nd 03 10:34 AM
How to set focus back to sheet after showing a user form Les[_4_] Excel Programming 0 July 21st 03 07:58 PM


All times are GMT +1. The time now is 08:02 PM.

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"