none
Run PowerPoint with the exe macro file. RRS feed

  • Question

  • My development environment is Windows 8 64Bit & 10 64Bit, and Visual Studio is 2013.

    The VBA file I wrote looks like this:

    // source start !!!

    Imports PowerPoint = Microsoft.Office.Interop.PowerPoint

    Module Module1

        Sub Main(ByVal path() As String)

            Dim oApplication As PowerPoint.Application = Nothing

            Dim oPressentation As PowerPoint.Presentation = Nothing

            Try

                oApplication = New Microsoft.Office.Interop.PowerPoint.Application()

                oPressentation = oApplication.Presentations.Add

                Dim macroPath As String = path(0)

                Dim savePath As String = path(1)

                oPressentation.VBProject.VBComponents.Import(macroPath)

                oApplication.Run("ExportPowerPoint")

                oPressentation.SaveAs(savePath)

            Catch ex As Exception

            Finally

                If Not oPressentation Is Nothing Then

                    oPressentation = Nothing

                End If

                If Not oApplication Is Nothing Then

                    oApplication = Nothing

                End If

                GC.Collect()

                GC.WaitForPendingFinalizers()

            End Try

        End Sub

    End Module

    // source end !!!

    When the function is executed, it executes the power point and executes the macro.

    However, if the power point is executed before executing the function, the function does not work properly when the exe file is executed. The same power point just turns on and ends.

    In addition, after executing the function, even if you run the power point on the desktop.
    Tuesday, October 22, 2019 5:02 AM

Answers

  • Hi,

    According to your description, your issue is more related about VBA. And this forum is discussing and asking questions about the vb.net.

    Ask in the following forum:

    Thank you for your understanding.

    Best Regards,

    Julie


    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. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Pada_ Tuesday, October 22, 2019 6:03 AM
    Tuesday, October 22, 2019 5:46 AM
    Moderator

All replies

  • Hi,

    According to your description, your issue is more related about VBA. And this forum is discussing and asking questions about the vb.net.

    Ask in the following forum:

    Thank you for your understanding.

    Best Regards,

    Julie


    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. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Pada_ Tuesday, October 22, 2019 6:03 AM
    Tuesday, October 22, 2019 5:46 AM
    Moderator
  • Thank you. I would like to ask a question in the forum.
    Tuesday, October 22, 2019 6:03 AM