Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Statement to give focus to a specific control on a UserForm?

I would like to put a statement in the intialization code (Private Sub
UserForm_Initialize()) of a UserForm to bring a certain textbox (or
any control) into focus. Something like

TextBox1.hasfocus = True

Is there a way to do this?

When I start to write such a statement in the VBA editor, I dont' find
anything dealing with focus in the list of properties and methods that
appears as context-sensitive help (sort of like a tool-tip)

When the Userform is "showning," the main menu of the Excel workbook
is grayed out, so I don't seem to be able to start the process of
recording a macro to see what the above code might be. Is there any
way to start a macro recording while the UserForm is "showing"? There
is no keyboard shortcut for starting "Record New Macro" on the main
Excel Menus, although I could go into keyboard customization and
assign one.

Thanks for any help.

Fred Holmes
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Statement to give focus to a specific control on a UserForm?

Fred,

Try SetFocus, or even give that control a TabIndex of 1 in the form design
mode.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fred Holmes" wrote in message
...
I would like to put a statement in the intialization code (Private Sub
UserForm_Initialize()) of a UserForm to bring a certain textbox (or
any control) into focus. Something like

TextBox1.hasfocus = True

Is there a way to do this?

When I start to write such a statement in the VBA editor, I dont' find
anything dealing with focus in the list of properties and methods that
appears as context-sensitive help (sort of like a tool-tip)

When the Userform is "showning," the main menu of the Excel workbook
is grayed out, so I don't seem to be able to start the process of
recording a macro to see what the above code might be. Is there any
way to start a macro recording while the UserForm is "showing"? There
is no keyboard shortcut for starting "Record New Macro" on the main
Excel Menus, although I could go into keyboard customization and
assign one.

Thanks for any help.

Fred Holmes



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Statement to give focus to a specific control on a UserForm?

SetFocus works, but why doesn't it show up in the "help" list of
properties and methods? Surely someone at MS has done a basic
completeness check?????

Thanks,

Fred Holmes

On Mon, 20 Dec 2004 17:08:10 -0000, "Bob Phillips"
wrote:

Fred,

Try SetFocus, or even give that control a TabIndex of 1 in the form design
mode.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fred Holmes" wrote in message
.. .
I would like to put a statement in the intialization code (Private Sub
UserForm_Initialize()) of a UserForm to bring a certain textbox (or
any control) into focus. Something like

TextBox1.hasfocus = True

Is there a way to do this?

When I start to write such a statement in the VBA editor, I dont' find
anything dealing with focus in the list of properties and methods that
appears as context-sensitive help (sort of like a tool-tip)

When the Userform is "showning," the main menu of the Excel workbook
is grayed out, so I don't seem to be able to start the process of
recording a macro to see what the above code might be. Is there any
way to start a macro recording while the UserForm is "showing"? There
is no keyboard shortcut for starting "Record New Macro" on the main
Excel Menus, although I could go into keyboard customization and
assign one.

Thanks for any help.

Fred Holmes



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Statement to give focus to a specific control on a UserForm?

Fred,

I am not sure by what you mean. I see SetFocus in the intelli-sense for a
textbox, and if you look up Setfocus in VBA help, it applies to a Textbox.

Where do you expect to see it?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fred Holmes" wrote in message
...
SetFocus works, but why doesn't it show up in the "help" list of
properties and methods? Surely someone at MS has done a basic
completeness check?????

Thanks,

Fred Holmes

On Mon, 20 Dec 2004 17:08:10 -0000, "Bob Phillips"
wrote:

Fred,

Try SetFocus, or even give that control a TabIndex of 1 in the form

design
mode.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fred Holmes" wrote in message
.. .
I would like to put a statement in the intialization code (Private Sub
UserForm_Initialize()) of a UserForm to bring a certain textbox (or
any control) into focus. Something like

TextBox1.hasfocus = True

Is there a way to do this?

When I start to write such a statement in the VBA editor, I dont' find
anything dealing with focus in the list of properties and methods that
appears as context-sensitive help (sort of like a tool-tip)

When the Userform is "showning," the main menu of the Excel workbook
is grayed out, so I don't seem to be able to start the process of
recording a macro to see what the above code might be. Is there any
way to start a macro recording while the UserForm is "showing"? There
is no keyboard shortcut for starting "Record New Macro" on the main
Excel Menus, although I could go into keyboard customization and
assign one.

Thanks for any help.

Fred Holmes





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
SpinButton control and focus Matt Dalkie Excel Programming 2 September 14th 04 02:36 PM
Show userform without it taking focus? leah Excel Programming 2 August 10th 04 07:07 PM
Set Focus Problem for textbox control on multipage control ExcelDeveloperSPR Excel Programming 1 July 16th 04 08:54 PM
Focus on Control before UserForm(s) pop up Bob Phillips[_6_] Excel Programming 0 May 5th 04 04:03 PM
UserForm Loss Focus Orlando Magalhães Filho Excel Programming 2 September 5th 03 04:47 AM


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