Consulting

Results 1 to 1 of 1

Thread: Macro to export visio document as pictures

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Oct 2018
    Posts
    1
    Location

    Macro to export visio document as pictures

    Hi, I wrote a visio macro that should open all “.vsdm” files in a directory and export in an image format the content of each file. The problem is that, when a file is opened (with the Openex command) the macro halts. Maybe there is an “interference” between my macro and the macros contained in the opened files? This is the code:

    Sub Exporter()
        Dim xfolder As String: Dim xfile As String
        Dim vsoDoc As Document: Dim astr As String
        Dim vsoPage As Visio.Page
        xfolder = ThisDocument.Path & "Srcdir"
        xfile = Dir(xfolder & "\*.vsdm")
        Do While xfile <> ""
            fname = xfolder & "" & xfile
            ' Documents.OpenEx fname, visOpenMacrosDisabled
            Set vsoDoc = Documents.OpenEx(fname, visOpenRW + visOpenMacrosDisabled)
            Set vsoPage = ActivePage
            astr = "C:\\Users\\foa2abt\\Desktop\\Visiodir\\Dstdir" & xfile & ".png"
            vsoPage.Export (astr)
            ' ActiveDocument.Close SaveChanges:=False
            vsoDoc.Close
            xfile = Dir
        Loop
    End Sub
    Last edited by Aussiebear; 12-31-2024 at 04:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •