'Export a 'PPTX' format file to 'SVG' format files using VBA in the PowerPoint Application

A 'pptx' format file should be able to export to a 'svg' file or some 'svg' files (just one slide to one 'svg' file) in the latest version of PowerPoint(the function is newly in the September of 2019), I can do it in PowerPoint Application. But I can not do it with the VBA in PowerPoint Application, however I can export the 'pptx' format file to a 'png' or 'jpg' or another format file with the VBA in the PowerPoint Application.The code in the VBA is:

Sub test()

With Application.ActivePresentation.Slides(1)
    .Export "c:\Graphic\Slide1", "svg"
End With

End Sub

And I got this error:

PowerPoint can't export the slide(s) because no installed converter supports this file type.

Actually what I want to do is that export the file by python(which use the pywin32 module), the code is:

from win32com import client as wc
ppt = wc.Dispatch('PowerPoint.Application')
doc = ppt.Presentations.Open(path)
doc.Slides(1).Export(file_path, 'svg')

And I got the same error:

Slide.Export : PowerPoint can't export the slide(s) because no installed converter supports this file type.

The code is really OK because if I change the 'svg' to 'png' or 'jpg' it works just fine.

2020-08-26 Additional part

I have updated the PowerPoint to the latest version and use makepy.py which from pywin32 to create a new py file from Microsoft PowerPoint 16.0 Object Library(2.c) named 91493440-5A91-11CF-8700-00AA0060263Bx0x2x12.py, I have compared the old file and the new file, they do have some differences, see the picture the difference between the new file and the old, but in the "Shapes Export" aspect they seems to be the same, see the picture ppShapeFormat. Anyway, I have tried the following code:

doc.Slides(1).Shapes('Rectangle 3').Export(file_path, i)

The " i " I have tried -5 to 20, but only 0-5 make some difference, the other exported files is the same with i = 1(which is JPG file), and I have looked around all the files, they are all binary file which can not be SVG file, so, how can I export Shapes to SVG?

By the way, I also have tried in VBA directly, and got the same result.

In case of the picture can not be shown, here are some key pieces of information:

    ppShapeFormatBMP              =3          # from enum PpShapeFormat
    ppShapeFormatEMF              =5          # from enum PpShapeFormat
    ppShapeFormatGIF              =0          # from enum PpShapeFormat
    ppShapeFormatJPG              =1          # from enum PpShapeFormat
    ppShapeFormatPNG              =2          # from enum PpShapeFormat
    ppShapeFormatWMF              =4          # from enum PpShapeFormat


Solution 1:[1]

SVG is a relatively new format in PowerPoint and it hasn't been added to the object model yet.

As a workaround, you can export as EMF. Like SVG, it's a vector format. Then convert to SVG using InkScape, which is free and scriptable.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Korchok