Txtbox set focus

D

DZ

Hi

I have placed a textbox on a worksheet from the Controls toolbar.

How can I set the focus on the textbox when the workbook is opened. I can't
find a method to set the focus to this control.

Thanks
 
L

L@ja

just a question.
you try the
ActiveSheet.Shapes("TextBox1").setfocus '--- ?

--
üdv:regards
L@ja


„DZ†ezt írta:
 
D

Dave D-C

ActiveSheet.Shapes("TextBox1").setfocus '--- ?
That give me a 'Run-time error '438'
Object doesn't support this property or method
 
D

Dave Peterson

Option Explicit
Sub Auto_Open()
Worksheets("sheet1").TextBox1.Activate
End Sub

In xl2003, I didn't have to select the sheet first.

If this doesn't work, try:

Option Explicit
Sub Auto_Open()
with worksheets("Sheet1")
.select
.TextBox1.Activate
end with
End Sub
 
D

DZ

Thanks for your responses. It's Excel 97.

I get 'Run-time error '438' with Activate. There doesn't seem to be a way to
do this with a Controls Toolbar textbox.

Regards

DZ
 
D

Dave D-C

In Module1:
Sub Auto_Open()
Sheets("Sheet1").TextBox1.Activate
End Sub

This works in my XL97 -- doesn't need sheet select.
I wonder what could be different? Dave D-C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top