ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Txtbox set focus (https://www.excelbanter.com/excel-programming/405198-txtbox-set-focus.html)

DZ

Txtbox set focus
 
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@ja

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

--
üdv:regards
L@ja


DZ ezt *rta:

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


Dave D-C[_3_]

Txtbox set focus
 
ActiveSheet.Shapes("TextBox1").setfocus '--- ?
That give me a 'Run-time error '438'
Object doesn't support this property or method
on my XL97. What version are you? Dave D-C

L@ja wrote:
just a question.
you try the
ActiveSheet.Shapes("TextBox1").setfocus '--- ?
--
dv:regards
L@ja


DZ ezt rta:
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



Dave Peterson

Txtbox set focus
 
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

DZ wrote:

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


--

Dave Peterson

DZ

Txtbox set focus
 
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

Dave Peterson

Txtbox set focus
 
It worked ok in xl2003 for me.

But I don't have xl97 to test.

DZ wrote:

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


--

Dave Peterson

Dave D-C[_3_]

Txtbox set focus
 
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

Dave Peterson wrote:
It worked ok in xl2003 for me.
But I don't have xl97 to test.


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



Dave Peterson

Txtbox set focus
 
Maybe the user made a typing error????

Who knows?

Dave D-C wrote:

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

Dave Peterson wrote:
It worked ok in xl2003 for me.
But I don't have xl97 to test.


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


--

Dave Peterson


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com