I want to automate the creation of an organisation chart based on an XL sheet using the Organization Chart Wizard in Visio 2002.
When I run the wizard manually, everything works fine: the chart is created on the selected page of the current document.
When I run the wizard via VBA, the chart is created BUT on page 1 of a NEW document! Please help me!!!
Btw, I also tried the complete syntax with /S-INIT, /S-ARGSTR but no change.
code snippet:
Dim objAddOn As Object
Dim pgNewPage As Visio.Page
Dim lastPage As Integer
Dim strArgs As String
Set pgNewPage = ThisDocument.Pages.Add()
lastPage = ThisDocument.Pages.Count
Debug.Print lastPage
Set objAddOn = Visio.Addons
strArgs = “/filename=” & Chr(34) & strFileName & Chr(34)
strArgs = strArgs + ” /name-field=Ref ”
strArgs = strArgs + “/manager-field=Ref_to ”
strArgs = strArgs + “/display-fields=Ref,Key ”
strArgs = strArgs + “/custom-property-fields=Min,Max ”
strArgs = strArgs + “/pages=0 ”
Debug.Print strArgs
objAddOn(“OrgCWiz”).Run (” /S-RUN ” + strArgs)
Many many thanks