Search code examples
filems-officeconvertersbulk

Bulk conversion VSDX files to VSD


is there any elegant way for bulk conversion of VSDX files to VSD? Please note - it's actual downgrade, not the other way around. Is it achievable by scripting? Or am I left for 3rd party tools..? Many thanks Kind regards


Solution

  • VBA Macro in Visio file will do it...

    Sub Converter()
    Dim StrFile As String
        Dim objFSO, destRow As Long
        Dim mainFolder, mySubFolder
        Dim fullPathFileName
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        mFolder = "C:\Users\sivancik001\Desktop\vsdx\" ' <<<< PATH TO BE CHANGED !!!!
        Set mainFolder = objFSO.GetFolder(mFolder)
        StrFile = Dir(mFolder & "*.vsdx*")
        'Do While Len(StrFile) > 0
            '... actions here ... but not needed as nothing should be in the root folder. files are in subfolders
            'StrFile = Dir
        'Loop
        For Each mySubFolder In mainFolder.SubFolders
            StrFile = Dir(mySubFolder & "\*.vsdx*")
            Do While Len(StrFile) > 0
                fullPathFileName = mySubFolder & "\" & StrFile
                'MsgBox fullPathFileName
                Application.Documents.Open fullPathFileName
                Application.ActiveDocument.SaveAs Left(fullPathFileName, Len(fullPathFileName) - 1)
                Application.ActiveDocument.Close
                Kill fullPathFileName
                StrFile = Dir
            Loop
        Next
    End Sub