Setting Height/Width...

J

Joe

I am new to this, so forgive me if this has already been asked.

I have a database that has all the information about my routers and
switches that I want to populate into Visio to build a network map.
Now I have it creating the "Router" object from the Network Symbols
VSS. I just haven't been able to find a way to resize the object (default
size is 1"x1"). I'd also like to change the Font size as well.

Any help would be appreciated.
 
J

John

Hi Joe,

Have a go with this. It's probably easier to resize it when you're dropping
it on the page as you then aready have a reference to the shape, but if
that's not convenient then you could always resize afterwards as long as you
have a unique way of identifying the shape (which I assume you will do).

Anyway, hope this helps

Best regards

John

PS - Visio's default measurement is in inches so if that's what you want,
then there's no need to specify (ie "=3" as opposed to "=75mm")


Sub ResizeRouter()

Dim pag As Page
Dim oRouterMaster As Master
Dim shp As Shape

'Quick check to get the right name of the stencil
Dim vDoc As Document
For Each vDoc In Application.Documents
Debug.Print vDoc.Name
Next vDoc

Set oRouterMaster =
Application.Documents("PERIPH_M.VSS").Masters("Router")
Set pag = Application.ActivePage
Set shp = pag.Drop(oRouterMaster, 1, 1)

'Now you have a reference to the new router shape you can resize etc.
shp.Cells("Height").Formula = "=75mm"
shp.Cells("Width").Formula = "=75mm"
shp.Cells("Char.Size").Formula = "=24pt"
shp.Cells("Char.Font").Formula = "=1"

End Sub
 
J

Joe

John,

Thanks. Worked like a champ.

John said:
Hi Joe,

Have a go with this. It's probably easier to resize it when you're dropping
it on the page as you then aready have a reference to the shape, but if
that's not convenient then you could always resize afterwards as long as you
have a unique way of identifying the shape (which I assume you will do).

Anyway, hope this helps

Best regards

John

PS - Visio's default measurement is in inches so if that's what you want,
then there's no need to specify (ie "=3" as opposed to "=75mm")


Sub ResizeRouter()

Dim pag As Page
Dim oRouterMaster As Master
Dim shp As Shape

'Quick check to get the right name of the stencil
Dim vDoc As Document
For Each vDoc In Application.Documents
Debug.Print vDoc.Name
Next vDoc

Set oRouterMaster =
Application.Documents("PERIPH_M.VSS").Masters("Router")
Set pag = Application.ActivePage
Set shp = pag.Drop(oRouterMaster, 1, 1)

'Now you have a reference to the new router shape you can resize etc.
shp.Cells("Height").Formula = "=75mm"
shp.Cells("Width").Formula = "=75mm"
shp.Cells("Char.Size").Formula = "=24pt"
shp.Cells("Char.Font").Formula = "=1"

End Sub
 

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