Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
.TextFrame.Characters.Text property readOnly in function??
I am trying to mirror the text in an Excell cell to the text
in a shape object using the code below. Cell B3: = 5/5/03 Cell B4: = =SomeWB.XLS!tmp(B3) Function tmp(dte As Range) As String // thisShape shape object already exists With ActiveSheet.Shapes("thisShape") .TextFrame.Characters.Text = dte.Value End With tmp = "OK" End Function // sub is run using Marco | Run Sub tmp() // thisShape shape object already exists With ActiveSheet.Shapes("thisShape") .TextFrame.Characters.Text = "mock date value" End With End Function I use the same code in a Sub and a Function, but the dte.Value won't display using the function. I even called the sub from a function an it still does not work. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
.TextFrame.Characters.Text property readOnly in function??
Generally, a function used in a worksheet can not alter values or other
aspects of the excel environment - they can only return a value to the cell in which they are located. I would suspect this limitation is the source of your problem. (calling a sub from a function doesn't get around this either). If you use a textbox from the forms toolbar, you can select it, go to the formula bar and enter =B3 <cr and the textbox will be linked to the cell. If it isn't a textbox, it still will probably work for some other type shapes. If it is a textbox from the control toolbox toolbar, then you can use the linked cell property. -- Regards, Tom Ogilvy "VB_Help" wrote in message om... I am trying to mirror the text in an Excell cell to the text in a shape object using the code below. Cell B3: = 5/5/03 Cell B4: = =SomeWB.XLS!tmp(B3) Function tmp(dte As Range) As String // thisShape shape object already exists With ActiveSheet.Shapes("thisShape") .TextFrame.Characters.Text = dte.Value End With tmp = "OK" End Function // sub is run using Marco | Run Sub tmp() // thisShape shape object already exists With ActiveSheet.Shapes("thisShape") .TextFrame.Characters.Text = "mock date value" End With End Function I use the same code in a Sub and a Function, but the dte.Value won't display using the function. I even called the sub from a function an it still does not work. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
textframe autofit | Excel Discussion (Misc queries) | |||
How to set text property of a check box to value of a cell? | Charts and Charting in Excel | |||
Function to move text 65 characters to next row in column? | Excel Worksheet Functions | |||
VBA Code For OR-Function Using Cell Property | Excel Discussion (Misc queries) | |||
expected sub, function, or property | Excel Programming |