Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel TextBox Control
I have a textbox named "txt_report_date" inserted in a worksheet called "admin"
When this worksheet is active I can populate the textbox value using the me syntax, me.txt_report_date = ... However I would like to set the value of the text box when the workbook opens. Can you please tell me how to reference the text box from the on open event of the workbook. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel TextBox Control
Qualify the object with a reference to the sheet, eg
ThisWorkbook.Sheet1.txt_report_date ' where sheet1 is the codename But if in any doubt about the sheet and object existing use one of these - ThisWorkbook.Worksheets("Sheet1").txt_report_date etc or even - Dim ole As OLEObject On Error Resume Next Set ole = ThisWorkbook.Worksheets("Sheet1").OLEObjects("txt_ report_date") On Error GoTo 0 If Not ole Is Nothing Then ole.Object.Value = Format(Now, "dd mmm yyyy") End If Regards, Peter T "James" wrote in message ... I have a textbox named "txt_report_date" inserted in a worksheet called "admin" When this worksheet is active I can populate the textbox value using the me syntax, me.txt_report_date = ... However I would like to set the value of the text box when the workbook opens. Can you please tell me how to reference the text box from the on open event of the workbook. Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel TextBox Control
Thanks. That worked great.
"Peter T" wrote: Qualify the object with a reference to the sheet, eg ThisWorkbook.Sheet1.txt_report_date ' where sheet1 is the codename But if in any doubt about the sheet and object existing use one of these - ThisWorkbook.Worksheets("Sheet1").txt_report_date etc or even - Dim ole As OLEObject On Error Resume Next Set ole = ThisWorkbook.Worksheets("Sheet1").OLEObjects("txt_ report_date") On Error GoTo 0 If Not ole Is Nothing Then ole.Object.Value = Format(Now, "dd mmm yyyy") End If Regards, Peter T "James" wrote in message ... I have a textbox named "txt_report_date" inserted in a worksheet called "admin" When this worksheet is active I can populate the textbox value using the me syntax, me.txt_report_date = ... However I would like to set the value of the text box when the workbook opens. Can you please tell me how to reference the text box from the on open event of the workbook. Thanks. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rich TextBox Control in excel 2007 | Excel Programming | |||
VBA Excel - Textbox disappearing BEHIND listview control - Zorder is useless. | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
Set Focus Problem for textbox control on multipage control | Excel Programming |