none
How to extract an audio file use vba? RRS feed

  • Question

  • hi,I use vba in offce 2016. I want to extract an audio file by vba. But it fails when I use code to get soundformat object: CSoundFormat soundFormat = pShape->get_SoundFormat();  The object soundFormat can not be called any funtion .

    I want to know why it fail?How to extract an audio file use vba?

    Thank you very much.

    Sunday, November 25, 2018 9:06 AM

Answers

All replies

  • Hi tangyuwu,

    Please check if this post will work for you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Monday, November 26, 2018 8:25 AM
    Moderator
  • THank you very much!!!
    Tuesday, November 27, 2018 1:10 AM
  • hi,Lou,

    I want to get the audio file full name from the msoMedoa shape in PowerPoint by VBA. I neet the file's path to copy and then I can reorganize them into html5 .  It contains the audio file information if the shape's type is ppMediaTypeSound. I can get the volume /StartPoint/EndPoint /Length/Muted/AudioCompressionType/AudioSamplingRate from mediaformat object. But I can not find the way to get the file path the shape contains when I choose to insert a file from PC. I find the soundformat object contains SourceFullName information . But it will pop a error message box that there is not any text prompt. I doubt it maybe support old office version and do not support the Office 2016.

    Tuesday, November 27, 2018 1:36 AM
  • Hi tangyuwu,

    >> I find the soundformat object contains SourceFullName information . But it will pop a error message box that there is not any text prompt. I doubt it maybe support old office version and do not support the Office 2016.

    PpSoundFormatType are Constants that specify the format of a sound file.

    In previous versions of Microsoft PowerPoint, these constants were passed to the Export method of the SoundFormat object and returned by the Type property of that object.

    In Microsoft Office PowerPoint 2007, the SoundFormat object was deprecated.

    For more information, please review the following link:

    PpSoundFormatType Enumeration (PowerPoint)

    Hopefully it helps you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Tuesday, November 27, 2018 2:28 AM
    Moderator
  • Thank you for so detail and professional in office.

    Is there a way to get the audio file path or a function to export the audio file by VBA? I search all objects and do not find currently.

    Thank you .

    Tuesday, November 27, 2018 9:04 AM
  • Hi tangyuwu,

    Do you just want to extract the original video from the PPTX file?

    If so, you can try the solution in this link:

    Export Video from powerpoint using VBA

    And I also found a case of VBA Export embedded video from Powerpoint presentation for your reference.

    Hopefully it helps you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by tangyuwu Tuesday, November 27, 2018 9:37 AM
    Tuesday, November 27, 2018 9:25 AM
    Moderator