Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default TextBox Characters Method - Need Help

Greetings:

I have the following line in an Excel VBA Macro:

ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, 500, 80, 120,
60).Select
Selection.AutoScaleFont = False
Selection.Characters(Start:=1, Length:=23).Font.Name = "Arial"

It runs perfectly well under Excell 2003, but under Excel 2007, I get the
following, very unhelpful, error message:

"Runtime error: 1004
Unable to get the Characters property of the TextBox class."

Sooo, what does unable to "get" the property mean. It doesn't exist? Has it
been removed? Am I not using it properly? Most important: What has changed in
Excel 2007 that this no longer works?

Thank you,
Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default TextBox Characters Method - Need Help

From what I've read in the newsgroup, xl2007 has trouble when you select shapes.

Maybe you could do it without the selection:

Dim myTB As Shape
Set myTB = ActiveChart.Shapes.AddTextbox _
(msoTextOrientationHorizontal, 500, 80, 120, 60)

myTB.OLEFormat.Object.AutoScaleFont = False
myTB.OLEFormat.Object.Characters(Start:=1, Length:=23).Font.Name = "Arial"

MarkCR wrote:

Greetings:

I have the following line in an Excel VBA Macro:

ActiveChart.Shapes.AddTextbox(msoTextOrientationHo rizontal, 500, 80, 120,
60).Select
Selection.AutoScaleFont = False
Selection.Characters(Start:=1, Length:=23).Font.Name = "Arial"

It runs perfectly well under Excell 2003, but under Excel 2007, I get the
following, very unhelpful, error message:

"Runtime error: 1004
Unable to get the Characters property of the TextBox class."

Sooo, what does unable to "get" the property mean. It doesn't exist? Has it
been removed? Am I not using it properly? Most important: What has changed in
Excel 2007 that this no longer works?

Thank you,
Mark


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default TextBox Characters Method - Need Help

Hi Dave:

Thanks for your response. It seemed like the right answer, but I am getting
the same error on the line:

myTB.OLEFormat.Object.Characters(Start:=1, Length:=23).Font.Name = "Arial"

Very strange...
Mark

"Dave Peterson" wrote:

From what I've read in the newsgroup, xl2007 has trouble when you select shapes.

Maybe you could do it without the selection:

Dim myTB As Shape
Set myTB = ActiveChart.Shapes.AddTextbox _
(msoTextOrientationHorizontal, 500, 80, 120, 60)

myTB.OLEFormat.Object.AutoScaleFont = False
myTB.OLEFormat.Object.Characters(Start:=1, Length:=23).Font.Name = "Arial"


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default TextBox Characters Method - Need Help

Sorry.

Try:

myTB.OLEFormat.Object.AutoScaleFont = False
myTB.TextFrame.Characters.Text = "asdfasdfasdfasdfasdfasdf"
myTB.TextFrame.Characters(Start:=1, Length:=23).Font.Name = "Arial"



MarkCR wrote:

Hi Dave:

Thanks for your response. It seemed like the right answer, but I am getting
the same error on the line:

myTB.OLEFormat.Object.Characters(Start:=1, Length:=23).Font.Name = "Arial"

Very strange...
Mark

"Dave Peterson" wrote:

From what I've read in the newsgroup, xl2007 has trouble when you select shapes.

Maybe you could do it without the selection:

Dim myTB As Shape
Set myTB = ActiveChart.Shapes.AddTextbox _
(msoTextOrientationHorizontal, 500, 80, 120, 60)

myTB.OLEFormat.Object.AutoScaleFont = False
myTB.OLEFormat.Object.Characters(Start:=1, Length:=23).Font.Name = "Arial"


--

Dave Peterson
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
Limit textbox to 255 characters vqthomf Excel Programming 2 December 19th 07 10:05 AM
Textbox: Number of Characters Bill[_30_] Excel Programming 1 July 2nd 06 10:12 PM
Validating number of characters in textbox Blondegirl[_9_] Excel Programming 2 May 10th 06 01:57 PM
exact number of characters in textbox JNW Excel Programming 5 October 21st 05 10:51 AM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 09:11 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"