Save a Visio file as pdf

C

cawleyp

I was hoping that somebody out there could help me?
I have a limited knowledge of excel VBA and I'm attempting to write a
macro in visio 2003, which will read all of the files within a
directory and
save them to an array and then convert all of the visio documents in a
pdf format. Graham Mayor from the Word groups created a macro (below)
to do something similar but from word and I was hoping to do the same
but in visio.
I'm working with Visio 2003 and Adobe acrobat 7.0, but the print
driver is a PDS-XChange 3.0
If anybody can point me in the write direction I'd appreciate it
Thanks in advance!!!
Sub PrintFolderContentsToPDF()
On Error GoTo err_FolderContents

Dim FirstLoop As Boolean
Dim DocList As String
Dim DocDir As String
Dim sPrinter As String


With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
DocDir = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If

sPrinter = ActivePrinter
ActivePrinter = "PDF-XChange 3.0"
Application.ScreenUpdating = False

FirstLoop = True

If Left(DocDir, 1) = Chr(34) Then
DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
End If

DocList = Dir$(DocDir & "*.doc")
Do While DocList <> ""
Documents.Open DocList
ActiveDocument.PrintOut
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
DocList = Dir$()
FirstLoop = False
Loop
Application.ScreenUpdating = True
ActivePrinter = sPrinter
Exit Sub
err_FolderContents:
MsgBox Err.Description
Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top