PowerShell and Visio – Opening a file

If all you want to do is open a Visio drawing then the simplest way is to use

Start-Process test.vsd

This will open the file in Visio ready for you to start work on it.

If you want to open the file and work on it programmatically then we have a little bit more to do.

$visio = New-Object -ComObject Visio.Application
$doc = $visio.Documents.Open("C:\Scripts\Visio\test.vsd")

Now we have our drawing we can start to do stuff with it

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>