Looking for a macro to save all pages as autocad drawing.

Started by whwaldrep, January 20, 2009, 05:02:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

whwaldrep

Looking for some help if anyone has a macro to do this, or a macro to show me the basics.

What I'm trying to do:

Save all pages to autocad drawing format with the save name being the page name.

it will loop thru about 50 pages.

Thank You.

Edit*  Sorry I should at least show you what I have.

Sub SaveAsDwg()

    Dim vsoPage As Visio.Page
    Set vsoPage = ActivePage

    vsoPage.Export (Application.ActiveDocument.Path & Application.ActiveWindow.Page & ".dwg")

End Sub


Edit* Google using "export" instead of SaveAs and came up with this

... and from Graham Wideman
This particular example cranks through all the pages in a single Visio file, and outputs GIF and WMF versions, using the visio file's directory as the location, and the page name as the base file name.
Set Pgs = Application.ActiveDocument.Pages
For N = 1 To Pgs.Count
Set Pg = Pgs(N)
PgName = Pg.Name

ExportName = Application.ActiveDocument.Path + PgName + ".GIF"
Pg.Export ExportName

ExportName = Application.ActiveDocument.Path + PgName + ".WMF"
Pg.Export ExportName
Next N




Visio Guy

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

whwaldrep

Thank you it was not hard once I figured out it was considered exporting, instead of save as.