I'm running Visio using automation and I'm having trouble getting the process ID of the Visio process to check when its complete. Here's my VB script:
Set visio = CreateObject("Visio.InvisibleApp")
Wscript.Echo visio.ProcessID
Set document = visio.Documents.OpenEx("somefile.vsd", &H88)
document.ExportAsFixedFormat 1, "somefile.pdf", 1, 0
visio.Quit
and running it with cscript // nologo.
The problem is that visio.ProcessID returns a number that isn't the actual Windows process ID (e.g. 6613 when the actual process ID is 8146). The cscript host seems to finish before the Visio process exits causing problems cleaning up temp files.
Here is the Visio reference notes for:
So the question is: how can I get the Visio process ID or detect when it has properly exited?
Thanks!