Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to retrieve text from the textframe of an oval shape in Excel?

It's straightforward to set text in the textframe of a shape using the
characters method but how can you retrieve the text? I've tried using text,
characters.caption and characters.text, and I've tried creating a characters
object and setting it from the characters method - nothing works. It looks
like a hole in the object model.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to retrieve text from the textframe of an oval shape in Excel?

Option Explicit
Sub testme()
Dim myOval As Oval
Dim myStr As String

Set myOval = Worksheets("sheet1").Ovals("Oval 1")

myStr = myOval.Caption
MsgBox myStr
End Sub

If you wanted to go through the Shapes collection:

Option Explicit
Sub testme2()
Dim myShape As Shape
Dim myStr As String

Set myShape = Worksheets("sheet1").Shapes("Oval 1")

myStr = myShape.DrawingObject.Caption
MsgBox myStr
End Sub

Greg M wrote:

It's straightforward to set text in the textframe of a shape using the
characters method but how can you retrieve the text? I've tried using text,
characters.caption and characters.text, and I've tried creating a characters
object and setting it from the characters method - nothing works. It looks
like a hole in the object model.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to retrieve text from the textframe of an oval shape in Excel?

Thanks - this works perfectly. I could have spent forever not finding out
that you have to use a different object to read and write the same property!
Greg McCormick

"Greg M" wrote:

It's straightforward to set text in the textframe of a shape using the
characters method but how can you retrieve the text? I've tried using text,
characters.caption and characters.text, and I've tried creating a characters
object and setting it from the characters method - nothing works. It looks
like a hole in the object model.

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
Excel 2002: How to draw an oval shape outline to the worksheet? Mr. Low Excel Discussion (Misc queries) 9 September 22nd 08 09:06 PM
use VBA to tell if all the text in a TextBox or TextFrame can be displayed [email protected] Excel Programming 1 March 15th 07 04:26 AM
TextFrame.Characters.Text returns truncated string Dennis Excel Programming 2 October 1st 06 11:23 PM
Interesting problem with VBA generated textbox (or textframe of shape) length Bill Dilworth Excel Programming 3 December 22nd 05 04:09 PM
Hyperlink within the TextFrame of Shape Object..? Robert Stober Excel Programming 0 October 12th 03 10:05 PM


All times are GMT +1. The time now is 12:41 AM.

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"