How to setfocus textbox framecontrol

dave8

Active Member
Joined
Jul 8, 2007
Messages
275
I created two (2) textboxes inside a frame. The frame I created is on a worksheet (not using USERFORM). What I want to do is have the cursor on the first textbox when I first open the worksheet. My code looks like this: Frame1.Controls("textbox1").setfocus . But, when the code executes, I get run-time error '2110', "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

Is the syntax correct to SetFocus on Textbox1? And, is there anything in the textbox1 property I need to set??


David
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Its from the ActiveX. Btw, how do I also access these properties? If I want the cursor to land on the second textbox2, for example, do I have to turn off the tabindex for textbox1 and activate textbox2?

For example:

frame1.controls("Textbox1").tabstop = false
frame1.controls("Textbox2").activate


Of course, the above example doesn't work, but you get the idea.
 
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,767
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top