Changes on a master shape and several visio documents

J

Juan Carlos

Hi, i have a question about inherit on Microsoft Visio. I have about 50
extern documents of visio, (doc1.vsd, doc2.vsd, etc.), the shapes i've used
are all the same for all the documents. Is it possible, that the changes i
make on the master shapes changes all the documents?? Sorry for my english,
i'm from spain
 
M

Mark Nelson [MS]

You would need to write code to do this. Visio 2003 has a Macro Recorder
feature that could help.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Juan Carlos

First of all, thanks for your attention, Mark. I understand what you say on
the post but i don't know how to do it. Suppose that i've fifty documents of
visio and in all this documents i've used the same pack of master shapes. How
is supposed that Visio could know how many documents i have if i increase the
numer of documents to sixty? The macro i defined before could help if the
number of documents are not the same as the time i record the macro?

Sincerely
Juan Carlos Moral
 
M

Mark Nelson [MS]

I was thinking more of a macro that made the change to a single document.
Then you could wrap that macro up with some code that discovered all the
documents and iterated through them.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Juan Carlos

I don't have yet the knowledge to code what you're saying. Could you add some
code for the location of the *.vsd files on a dir? I think i could go on from
here. Thanks for your attention

Sincerely
Juan Carlos Moral
 
J

John Marshall, MVP

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
 

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