Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate visio from VB

Status
Not open for further replies.

kken

Programmer
Jun 5, 2001
51
CA
Hi all:

I am using VB.net and Visio 2003. I am trying to take an excel file and make a visio file. I can actually use a .bat file to create the visio file using this command:

c:\Program Files\Microsoft Office\Visio11\DLL\OrgWiz.exe" \wait /FILENAME=C:\Documents and Settings\cdaniels\My Documents\scalar test\cfts.csv /UNIQUE-FIELD=UniqueID /NAME-FIELD=Item /MANAGER-FIELD=ParentID /PAGES=401 10,402 10, 403 10 /DISPLAY-FIELDS=UniqueID,Item

But there is no way to save the file and close out Visio so the automation is incomplete.

Is there a way to import that excel file in visio from VB.net?

Thanks in advance
 
Hi all:
Thanks for your efforts. Here is the solution I came up with.

Dim objVisio As Object
Dim objAddOn As Object

'START THE ORG CHART WIZ
objVisio = CreateObject("Visio.Application")
objAddOn = objVisio.Addons.ItemU("OrgCWiz")
objAddOn.Run("/S-INIT")


' add your arguments
objAddOn.Run("/S-ARGSTR " + strCommandPart)'/NAME
'FIELD=Item etc.
strCommandPart = " /FILENAME=" & strFile
objAddOn.Run("/S-ARGSTR " + strCommandPart)

'Run the wizzard
objAddOn.Run("/S-RUN")

' Save the document
objVisio.ActiveDocument.SaveAsEx(strNewFile, 2 + 4)
objVisio.Quit()
objVisio = Nothing
GC.Collect()
 
Was looking through your post and was wondering if you could help me out with my issue. I'm using Orgwiz to import my file, works fine except for the save portion, could you explain how your the VB code works? I'm new to visio and VB, is the VB code something you compiled externally and therefore is a stand alone program? I'm trying to do this within Peoplesoft and I can call external programs, like Orgwiz, but I need someting to make Visio save the file it has created.

Thanks
Rickey
Rkondoudis@pepsimidamerica.com

 
Hey RKondoudis:
The code is compiled in VB. The program runs the orgwiz then saves the file then closes. It's been a while since I worked on it but it worked well. I've never used peoplesoft so I can't help you there.


Good Luck
Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top