Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ading shapes automatically on page creation

Status
Not open for further replies.

howzatUK

IS-IT--Management
Oct 14, 2005
23
GB
Hi all

I am working in Visio and need to add a textbox or square called title to each new page i create.

Can anyone help?

A greatful novice

 
Hi,

I bearly know how to spell Visio, but I am a former novice in Excel VBA.

Here are some "tips"

Check out
Get familiar with the Visio Object Model -- heirarchy, properties, methods.

There are probably similarities between the Visio Object Model and the object models for the applications that are more popular, like Excel and Word.

For instance, if Page is an object, then there's likely an Add method like for a Slide in PowerPoint. However, in Word, there is no Page object.

Shapes, like rectangles, are objects. Again, you need to understand the Object Model to understand what "Parent" a shape is a property of.

In Help you will see, for instance, a definition of Shapes and Shape and it will explain the COLLECTION concept which is part of the Object Model.

Does Visio have a Macro Recorder? That can be BOTH a great learning tool and a helpful code construction starting point.

Trial and error -- Code and learn.

Post back with a specific code example when you run into trouble. You may get some help from a Visio novice, who might also be a former VBA novice.

Skip,
[sub]
[glasses] [red]Be Advised![/red] A man who jumps from a bridge in Paris, is…
INSANE! [tongue][/sub]
 
Hi tanks for the post

Ok so the following code creates a rectangle, have you any ideas how I could name it? So that when i look at the properties in visio it is always called title?

Also do you have any ideas how I can set the properties so it doesnt have a border and contains some dummy text perhaps?

thanks again

 
there is a useful 'record macro' feature...might be helpful, record your actions then look at the code and it will point you in the right direction. check out the Shape object in visio then as suggested look for its properties...if .Name is a read/write property then you are way....watch out for uniqueness though
 
BTW, where's your code?

Use a technique like this...
Code:
  Dim oShp as Object
...
  Set oShp = SomeApplicationObject.Shapes.Add
  With oShp
     .Name = "title"
     .Top = 150
     .Left = 200
  End With
...
  Set oShp = Nothing


Skip,
[sub]
[glasses] [red]Be Advised![/red] A man who jumps from a bridge in Paris, is…
INSANE! [tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top