aksnk89

PDI To SVG Bulk Convertor and Vice versa

Discussion created by aksnk89 Champion on Sep 28, 2014
Latest reply on Jan 15, 2016 by dbruffell

Hi All,

 

I have to convert 180 PDI displays to SVG so that i can use them on Webparts and also while converting the display i want ensure that the display are save in " Zoom= FitAll" mode. For this bulk conversion i had written the following basic code as per my undersatnding (Newbee) but unfortunately after converting some displays it hangs. Can anyone give this a try ?

 

Public Function FileList(Mask As String) As String()

 

    Dim file As String

 

    Dim sAns() As String

 

    Dim i As Integer

 

    file = Dir(Mask, vbNormal)

 

    i = 0

 

    While (file <> "")

 

        ReDim Preserve sAns(i) As String

 

        sAns(i) = file

 

        i = i + 1

 

        file = Dir

 

    Wend

 

    FileList = sAns

 

End Function

 

Private Sub cmdSvg_Click()

 

    Dim sarr() As String

 

    Dim path As String

 

    path = TextBox1.Text & "\"

 

    sarr = FileList(path & "*.pdi")

 

    For Each file In sarr

 

        Dim newfile As String

 

        newfile = Replace(file, ".pdi", ".svg", , , vbTextCompare)

 

        Dim d As Display

 

        Set d = Application.Displays.Open(path & file, True)

 

        d.Zoom = "FitAll"

 

        d.SaveAs path & newfile, pbpdFormatSVG

 

        d.Close (True)

 

    Next

 

End Sub

Outcomes