Here is some code
Sub ProcessDirectory()
' Process all the Visio drawings in the current directory
' Look in the current directory for Visio files and process each one by
' passing each page to a subroutine
' Remember to ignore processing this Visio file.
' John Marshall
Dim curDocIndx As Integer
Dim CurFileName As String
Dim curPageIndx As Integer
Dim currentDoc As String
Dim docObj As Visio.Document
Dim docsObj As Visio.Documents
Dim PagObj As Visio.Page
Dim PagsObj As Visio.Pages
Dim PathFileName As String
Dim PathName As String
currentDoc = ActiveDocument.Name ' Remember the current VSD name so it can
be ignored.
' Set the default pathname
PathName = CurDir & "\"
PathFileName = PathName & "*.vsd"
' Find the first file from the directory (not necessarily the first
alphabetically)
CurFileName = Dir(PathFileName)
Do While CurFileName <> ""
If CurFileName <> currentDoc Then ' ignore the current document
' Open the file
PathFileName = PathName & CurFileName
Set docObj = Documents.Open(PathFileName)
Set PagsObj = docObj.Pages
' iterate through the collection of pages
For curPageIndx = 1 To PagsObj.Count
' retrieve the page object at the current index
Set PagObj = PagsObj(curPageIndx)
' Ignore if the current page is a background page
If PagObj.Background = False Then Call ProcessPage(PagObj)
Next curPageIndx ' Handle the next page
docObj.Close
End If ' Finished ignoring the current document
CurFileName = Dir ' Find the next Visio drawing
Loop
End Sub
Sub ProcessPage(ByRef PagObj As Visio.Page)
' Process a Page of an OrgChart
End Sub
John... Visio MVP
Need stencils or ideas?
http://www.mvps.org/visio/3rdparty.htm
Need VBA examples?
http://www.mvps.org/visio/VBA.htm
Common Visio Questions
http://www.mvps.org/visio/common_questions.htm
Visio Wishlist
http://www.mvps.org/visio/wish_list.htm