Exc el macro to Create Visio Shapes

azjd2009

New Member
Joined
Jun 5, 2013
Messages
3
I found this code elsewhere on this Forum and it works fine. It creates a visio shape for each cell in the selected range. The problem is that it creates each new shape on its own NEW Visio drawing page.

How would I modify this macro to create each shape on the SAME Visio drawing. I don't care if they cover each other's position; I just want to have them on the same drawing.

----------------
Sub VisioFromExcel()
Dim AppVisio As Object
Dim oCharacters As Object
Dim lX As Long
Dim sChar As String

Set AppVisio = CreateObject("visio.application")
AppVisio.Visible = True

For lX = 1 To Cells(Rows.Count, 1).End(xlUp).Row
AppVisio.Documents.AddEx "block_u.vst", 0, 0
AppVisio.Windows.ItemEx(lX).Activate
AppVisio.ActiveWindow.Page.Drop AppVisio.Documents.Item("BLOCK_U.VSS").Masters.ItemU("Box"), 1.35, 9.8
AppVisio.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "20 pt"

Set oCharacters = AppVisio.ActiveWindow.Page.Shapes.ItemFromID(1).Characters
oCharacters.Begin = 0
oCharacters.End = Len(oCharacters)
sChar = Cells(lX, 1).Value
oCharacters.Text = sChar

Next

Set oCharacters = Nothing
Set AppVisio = Nothing

End Sub
--------------------

Thanks,

Joe
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top