Automating Microsoft Visio

This example opens a Microsoft Visio document and prints the save-time and creation-time of the Visio document:

import sys, win32com.client

doc = sys.argv[1]
     visio = win32com.client.Dispatch("Visio.Application")
     visio.Visible = 0
          dwg = visio.Documents.Open(doc)
          print dwg.TimeCreated, ",", dwg.TimeSaved
     except Exception, e:
          print "Error", e
except Exception, e:
     print "Error opening file",e

One Reply to “Automating Microsoft Visio”

  1. Hi!
    Do you know, how to set the Text font weight to bold and the Text alignment to top and left?
    Do you also know, how to set the connector line style to a normal line without pointers and the line to straight line?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.