How to append to a shape text

P

PaulM

I am a novice Visio programmer.

I have a shape with text in it, that I want to append more text.

The first few characters (or run) have a different style than do the last
characters.

My simplistic attempt was to do:

shape.text = shape.text + newtext

This appended the text, but also changed the formatting for all characters
to match that of the first run of characters.

Can anyone suggest a method (preferably a code example) to append using the
character style of the last character in the existing text?

Thanx
 
A

Al Edlund

Have you considered the v2003 sdk. Under Shapes (in the library) it has text
and formatting examples.
al
 
P

PaulM

Forgot to mention, I was using Visio 2000.

I did get access to a Visio 2003 version, and I think I found my answer
using the macro recorder.

shape.text.characters.begin = shape.text.characters.end
shape.text.characters.text = newtext

It appears that the properties begin and end work as a selection range and
the text effectively gets set to that selection range.

One could use that range to replace sections of text.


Thanks for the tip on the 2003 SDK.


PaulM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top