Edit Text and Inserted Field in Textbox

J

John

Hi there,

I have a number of files all of which have a similar title textbox (part of
a group page border) on a number of background pages. The text itself
contains an inserted field which displays the current foreground page name
(eg: "This Is The First [PageName] Drawing").

The problem is how do I go about changing the text but retain the inserted
field?

Main objective - is to have a form with a textbox the contents of which will
be applied to the background pages.

Note that the inserted filed already exists in the shape.

Best regards

John
 
J

John

Hi June,

Yes, that's why I've posted this to the vba group. Perhaps I wasn't clear.
Should I write something like:

shp.Text = "This is the first" & PageNameInsertedField & " drawing"

My assumption though, is that as the text is overwritten, the inserted field
would be lost and therefore it wouldn't be available to reference in the
shp.Text....statement.

Is that right?

John


JuneTheSecond said:
VBA may be a good help.

John said:
Hi there,

I have a number of files all of which have a similar title textbox (part
of
a group page border) on a number of background pages. The text itself
contains an inserted field which displays the current foreground page name
(eg: "This Is The First [PageName] Drawing").

The problem is how do I go about changing the text but retain the inserted
field?

Main objective - is to have a form with a textbox the contents of which
will
be applied to the background pages.

Note that the inserted filed already exists in the shape.

Best regards

John
 
J

John Marshall, MVP

This should do what you want:

Dim vsoChar1 As Visio.Characters
Set vsoChar1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Characters
vsoChar1.Begin = 0
vsoChar1.End = 0
vsoChar1.Text = "This is the first drawing"

ActiveWindow.DeselectAll
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemFromID(1),
visSelect
Set vsoChar1 = Application.ActiveWindow.Selection.Item(1).Characters
vsoChar1.Begin = 18
vsoChar1.End = 18
vsoChar1.AddFieldEx visFCatPage, visFCodePageName, visFmtStrNormal,
1033, 0


John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
John said:
Hi June,

Yes, that's why I've posted this to the vba group. Perhaps I wasn't
clear. Should I write something like:

shp.Text = "This is the first" & PageNameInsertedField & " drawing"

My assumption though, is that as the text is overwritten, the inserted
field would be lost and therefore it wouldn't be available to reference in
the shp.Text....statement.

Is that right?

John


JuneTheSecond said:
VBA may be a good help.

John said:
Hi there,

I have a number of files all of which have a similar title textbox (part
of
a group page border) on a number of background pages. The text itself
contains an inserted field which displays the current foreground page
name
(eg: "This Is The First [PageName] Drawing").

The problem is how do I go about changing the text but retain the
inserted
field?

Main objective - is to have a form with a textbox the contents of which
will
be applied to the background pages.

Note that the inserted filed already exists in the shape.

Best regards

John
 
J

John

That's great. Thanks very much John.

Best regards

John
John Marshall said:
This should do what you want:

Dim vsoChar1 As Visio.Characters
Set vsoChar1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Characters
vsoChar1.Begin = 0
vsoChar1.End = 0
vsoChar1.Text = "This is the first drawing"

ActiveWindow.DeselectAll
ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemFromID(1),
visSelect
Set vsoChar1 = Application.ActiveWindow.Selection.Item(1).Characters
vsoChar1.Begin = 18
vsoChar1.End = 18
vsoChar1.AddFieldEx visFCatPage, visFCodePageName, visFmtStrNormal,
1033, 0


John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
John said:
Hi June,

Yes, that's why I've posted this to the vba group. Perhaps I wasn't
clear. Should I write something like:

shp.Text = "This is the first" & PageNameInsertedField & " drawing"

My assumption though, is that as the text is overwritten, the inserted
field would be lost and therefore it wouldn't be available to reference
in the shp.Text....statement.

Is that right?

John


JuneTheSecond said:
VBA may be a good help.

John said:
Hi there,

I have a number of files all of which have a similar title textbox (part
of
a group page border) on a number of background pages. The text itself
contains an inserted field which displays the current foreground page
name
(eg: "This Is The First [PageName] Drawing").

The problem is how do I go about changing the text but retain the
inserted
field?

Main objective - is to have a form with a textbox the contents of which
will
be applied to the background pages.

Note that the inserted filed already exists in the shape.

Best regards

John
 

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