Skip to main content.
home | support | download

Back to List Archive

Re: Powerpoint and Visio

From: <Mike.Fountain(at)>
Date: Sun Jan 29 2006 - 15:57:38 GMT
Well, I may be making progress....  Wanted to post the direction I'm
heading now just to see if anyone has any comments, and hopefully someone
will find this useful.

Can't find anything that is going to be able to read native Viso .vsd
But, Visio can save the files as "XML Drawing" with a .vdx extension.
Being XML, it shouldn't take too much work from that point to get swish to
index it.  Haven't looked at the XML filters and such yet, but should just
be a matter of pulling out the tags we want.

In  visio .vdx files, its this:
<Subject>test sub</Subject>
<Keywords>test key</Keywords>
<Desc>test desc</Desc>
<Manager>test man</Manager>
<Category>test cat</Category>
... other tags

... bunch of other tags. but, only one I'm interested in is

Next problem - converting existing .vsd files into .vdx files.    Found
someone that must have been doing something similar, and has a vb script
that can run to do this.  Only requirement is that you have to have visio
first in order to convert these files.  I had about 50 files to conver in
about 10-15 directories.  A minor pain, but now we just have to save all
new visio files as .vdx instead of .vds.  One other note about this method
- the .vdx files are anywhere from 3 to 5 times larger than the original
vsd files.  So, if you produce huge multi-MB files, you may want to
consider this.  Think our largest file went from about 1.5 MB to about 6 MB

To get this to run, open a drawing in visio (any drawing will work) and do
"tools / macros / visual basic editor".   In that new window, select
"insert / module"
In that editor window, past the follwing (change the directories to be
yours of course)
Note - this worked fine for me, but its a cut&paste job, I know absolutely
nothing about vb.

'DESCRIPTION: Saves all of the VSD files in a given folder as VDX files

'Change to match the folder that contains all of the VSD files you want to
Private Const SOURCEPATH As String = "C:\Documents and

'Change to match the folder where you want the VDX files to be saved to.
The folder must exist.
Private Const TARGETPATH As String = "C:\Documents and

Public Sub Main_()
End Sub

Private Sub ConvertVSDToVDX(sourceFolder As String, targetFolder As String)
    Dim docToSave As Document
    Dim sourceFile As String

    On Error GoTo ConvertVSDToVDX_ErrorHandler

    sourceFile = Dir$(sourceFolder & "\" & "*.vsd")

    If sourceFile <> "" Then

        'NOTE: You might need to use Application.AlertResponse to
        'respond to any dialogs that appear as a result of opening a

        'Open the source vsd
        Set docToSave = Application.Documents.OpenEx(sourceFolder & "\" &
sourceFile, visOpenRO)

        'Save the document to vdx. Original file name minus extension
        docToSave.SaveAs targetFolder & "\" & Left$(docToSave.Name,
Len(docToSave.Name) - 4) & ".vdx" 'assume 4 character extension

        'Ensure we aren't asked to save and close the doc
        docToSave.Saved = True

        'Clean up the doc object
        Set docToSave = Nothing

        sourceFile = Dir$

        Loop While (sourceFile <> "")
    End If
Exit Sub


    Dim choice As Integer

    choice = MsgBox("An error has occurred!" & vbCrLf & vbCrLf &
Err.Description & vbCrLf & vbCrLf & "Continue?", vbCritical + vbYesNo,
"Save As VDX Error")

    If choice = vbYes Then
        Resume Next
    End If
End Sub
Received on Sun Jan 29 07:57:40 2006