L
Lant
I have used VBA and automated a Visio solution which brings up a drawing
template and some custom stencils docked on a side. In the course of user
interaction, I create some more new stencils (by dropping shapes on a drawing
page and assigning custome properties from the database). Once these custom
stencils are created, I would like to add (tile or layer like other stencils)
them to the other stencils.
I use the following steps to 'Create' , 'Add' , and 'Dock' the stencil. But
it does not get arranged along with the other stencils on the left of the
template. How do I fix it? I am not very clear about the object model -
document collection, document, sheet, windows, etc. in this context. Thanks
for any suggestions.
This is the code I have:
Set rsElements = New ADODB.Recordset
Set rsElements = conn.Execute(strSelect)
Set stencil = ThisDocument.Application.Documents.Open("SampleShape.VSS")
Dim vsoDocument As Visio.Document
Set vsoDocument = Application.Documents.Add(APPLOCATION & "blank.vsd")
Set mstElement = stencil.Masters("Element") ' Get the master named "Element"
and drop that shape on the page!
'Use the records to create Element Stencil
Do Until rsElement.EOF
Set elementShape = vsoDocument.Pages(1).Drop(mstElement, x, y)
elementShape.Text = rsElements!ElementName
'Set xy position
y = (y - 1)
If (y < 1) Then
x = x + 1
y = 10
End If
'Next Element
rsClientProducts.MoveNext
Loop
'Save file as Element Stencil file
vsoDocument.SaveAs "ElementStencil.vss"
Application.Documents.AddEx "ElementStencil.vss", visMSDefault, visAddDocked
+ visAddStencil
template and some custom stencils docked on a side. In the course of user
interaction, I create some more new stencils (by dropping shapes on a drawing
page and assigning custome properties from the database). Once these custom
stencils are created, I would like to add (tile or layer like other stencils)
them to the other stencils.
I use the following steps to 'Create' , 'Add' , and 'Dock' the stencil. But
it does not get arranged along with the other stencils on the left of the
template. How do I fix it? I am not very clear about the object model -
document collection, document, sheet, windows, etc. in this context. Thanks
for any suggestions.
This is the code I have:
Set rsElements = New ADODB.Recordset
Set rsElements = conn.Execute(strSelect)
Set stencil = ThisDocument.Application.Documents.Open("SampleShape.VSS")
Dim vsoDocument As Visio.Document
Set vsoDocument = Application.Documents.Add(APPLOCATION & "blank.vsd")
Set mstElement = stencil.Masters("Element") ' Get the master named "Element"
and drop that shape on the page!
'Use the records to create Element Stencil
Do Until rsElement.EOF
Set elementShape = vsoDocument.Pages(1).Drop(mstElement, x, y)
elementShape.Text = rsElements!ElementName
'Set xy position
y = (y - 1)
If (y < 1) Then
x = x + 1
y = 10
End If
'Next Element
rsClientProducts.MoveNext
Loop
'Save file as Element Stencil file
vsoDocument.SaveAs "ElementStencil.vss"
Application.Documents.AddEx "ElementStencil.vss", visMSDefault, visAddDocked
+ visAddStencil