Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default .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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default .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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
textframe autofit Gab Excel Discussion (Misc queries) 0 July 14th 08 12:57 AM
How to set text property of a check box to value of a cell? Naum Charts and Charting in Excel 5 December 11th 07 06:44 PM
Function to move text 65 characters to next row in column? Nat1 Excel Worksheet Functions 7 December 13th 06 05:23 PM
VBA Code For OR-Function Using Cell Property kylie Excel Discussion (Misc queries) 1 June 20th 06 02:42 AM
expected sub, function, or property Josh[_3_] Excel Programming 3 July 17th 03 09:48 PM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"