Automating Org chart wizard - wierd issue

S

SK

Hi All ,
I've wrote a VB script to read a file and create a org chart in VISIO 2003
.. Does it work ? - YES and NO ... Here is the issue I have :

After installing Visio 2003 , the first time I ran my script , it created 16
pages (one for each box) instead of all the information in one page . Trying
out several things , I took the same input file and ran the wizard manually
and all the information came out in one page .. just as I wanted . Now when I
run my script again , it worked perfectly .. displaying all the information
in just one page . I'm thinking there is some setting that is being turned on
when I run the wizard manually ... My issue is : When I run this scrip on a
NT server through anothe program , VISIO process is kicked off as SYSTEM and
it generates different pages again . If I logon to the server and run it
with my local user ID it works fine when I do the two steps(1- run the
wizard manually and 2- run using the script).
Is there any setting that I am missing ??

Any suggestions are greatly appreciated.

Here is the script :

Dim objVisio , wb
Dim objAddOn , ws

'START THE ORG CHART WIZ
Set objVisio = CreateObject("Visio.Application")
objVisio.Visible = false
Set objArgs = WScript.Arguments
strFile = objArgs(0)


objVisio.Visible = false
Set objAddOn = objVisio.Addons.ItemU("OrgCWiz")
objAddOn.Run("/S-INIT")

' add your arguments
strCommandPart = " /DISPLAY-FIELDS=Name,Position /FILENAME= " & strFile
objAddOn.Run("/S-ARGSTR " + strCommandPart)



'Run the wizzard
objAddOn.Run("/S-RUN")
objVisio.Addons("SaveAsWeb").Run "/quiet=True /target=C:\temp\test.htm
/startpage=1 /endpage=1 "
objVisio.ActiveDocument.SaveAsEx "c:\temp\filename.vsd", visSaveAsRO



' Save the document
objVisio.ActiveDocument.SaveAsEx(strNewFile, 2 + 4)
objVisio.Quit()
 
B

Barb Way

Out of curiosity, if you run manually and close Visio, then run the script,
does it always work correctly from then on for that user ID? I'm guessing
that there are settings in the User registry that are engaged here, in that
case. Visio 2003 (and 2007) isn't a Server application, it is a Client
app. I'm not sure why the lack of prior User settings would cause this
particular side effect, however.

I can't get the script sample you provided to run correctly at all. If I
change the Visible setting to True I see Visio open, but it never calls the
addon. Do you have a better sample that you can share which I can test
with?

Barb Way
Product Support - Visio
Microsoft Corporation
[This posting is provided "As Is" with no warranties, and confers no
rights.]
--------------------

Hi All ,
I've wrote a VB script to read a file and create a org chart in VISIO
2003
. Does it work ? - YES and NO ... Here is the issue I have :

After installing Visio 2003 , the first time I ran my script , it created
16
pages (one for each box) instead of all the information in one page .
Trying
out several things , I took the same input file and ran the wizard manually
and all the information came out in one page .. just as I wanted . Now when
I
run my script again , it worked perfectly .. displaying all the information
in just one page . I'm thinking there is some setting that is being turned
on
when I run the wizard manually ... My issue is : When I run this scrip on a
NT server through anothe program , VISIO process is kicked off as SYSTEM
and
it generates different pages again . If I logon to the server and run it
with my local user ID it works fine when I do the two steps(1- run the
wizard manually and 2- run using the script).
Is there any setting that I am missing ??

Any suggestions are greatly appreciated.

Here is the script :

Dim objVisio , wb
Dim objAddOn , ws

'START THE ORG CHART WIZ
Set objVisio = CreateObject("Visio.Application")
objVisio.Visible = false
Set objArgs = WScript.Arguments
strFile = objArgs(0)


objVisio.Visible = false
Set objAddOn = objVisio.Addons.ItemU("OrgCWiz")
objAddOn.Run("/S-INIT")

' add your arguments
strCommandPart = " /DISPLAY-FIELDS=Name,Position /FILENAME= " & strFile
objAddOn.Run("/S-ARGSTR " + strCommandPart)



'Run the wizzard
objAddOn.Run("/S-RUN")
objVisio.Addons("SaveAsWeb").Run "/quiet=True /target=C:\temp\test.htm
/startpage=1 /endpage=1 "
objVisio.ActiveDocument.SaveAsEx "c:\temp\filename.vsd", visSaveAsRO



' Save the document
objVisio.ActiveDocument.SaveAsEx(strNewFile, 2 + 4)
objVisio.Quit()
 
V

visot

Hello Barb,

I have a similar issue running the above with the /PAGES argument.
specify a name and number of levels and receive the following error:
""Employee name "<Name>" is not in your organization data"

If I remove the /PAGES argument, it works fine for me.

Below is my string of arguments:

strCommandPart = "/DISPLAY-FIELDS=Name,JobTitle,Dep
/FILENAME=C:\temp\Headcount2.xls /HYPERLINK-ACCROSS-PAGES /PAGES='Josse
Goldberg' 3 " & strFile

TIA!!!
visio
 

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