Seems like a simple task

J

JamesO

Hello,

I need to create a title for a pageprogramatically.

In visio I would select the text tool and place it, type in my text, resize
and move it to the right location.

I can't seem to figure out how to do this progamatically. I'd be happy if I
could at least place the text.

Thanks in advance for any help.
 
A

Al Edlund

If you're using v2003 it is as simple as recording a macro of the steps that
you want to accomplish and saving it.
I often use this as a short cut when writing code.
Al
 
A

Al Edlund

try this,
' add the text shape
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Add Text Shape")
Dim vsoShape1 As Visio.Shape
Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(2#, 9.25,
6.5, 10.25)
vsoShape1.TextStyle = "Block Normal"
vsoShape1.LineStyle = "Text Only"
vsoShape1.FillStyle = "Text Only"
Application.EndUndoScope UndoScopeID1, True

' put some text in it
Dim vsoCharacters2 As Visio.Characters
Set vsoCharacters2 =
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Characters
vsoCharacters2.Begin = 0
vsoCharacters2.End = 0
vsoCharacters2.Text = "MyTitleBlock"

' change the font size
Dim UndoScopeID3 As Long
UndoScopeID3 = Application.BeginUndoScope("Font Size")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionCharacter,
0, visCharacterSize).FormulaU = "18 pt"
Application.EndUndoScope UndoScopeID3, True

' change the font type
Dim UndoScopeID4 As Long
UndoScopeID4 = Application.BeginUndoScope("Font")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionCharacter,
0, visCharacterFont).FormulaU = "26"
Application.EndUndoScope UndoScopeID4, True
 

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