running an excel macro from powerpoint

답변됨 running an excel macro from powerpoint

  • 2012년 4월 23일 월요일 오전 6:49
     
     

    i have a PowerPoint that has buttons that need to run excel macros without having to open excel each time i have code that works but requires excel to be opened and closed every time as follows: 



    Sub Run_Excel_Macro_From_PPT()
    Dim oXL As Excel.Application            ' Excel Application Object
    Dim oWB As Excel.Workbook               ' Excel Workbook Object
    Dim sPName As String                    ' Variable - Active Presentation Name

    On Error GoTo Err_PPXL


    Set oXL = New Excel.Application
    Set oWB = oXL.Workbooks.open("G:\Documents\psi development\old developemt files\120420_DMX Controller rev4.xlsm")

    ' Set Excel as Visibile - Turn Off if not needed
    oXL.Visible = True

    ' Pass and Argument
    sPName = ActivePresentation.Name

    ' Run the Macro without Argument
    oXL.Application.Run "'PSI100'"

    ' Save and Close the Workbook
    oWB.Save
    oWB.Close (False)


    ' Quit the Excel
     oXL.Quit


    ' Release Objects - Good Practive
    If Not oWB Is Nothing Then Set oWB = Nothing
    If Not oXL Is Nothing Then Set oXL = Nothing


    Err_PPXL:
    If Err <> 0 Then
        MsgBox Err.Description
        Err.Clear
    End If

    End Sub

     

모든 응답

  • 2012년 4월 24일 화요일 오전 2:54
    중재자
     
     

    Hi ianlynk,

    Thanks for posting in the MSDN Forum.

    Would you please clarify your goal? Do you want to handle exel issue without Excel Object Moduel? It seems impossible if it is.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

  • 2012년 4월 24일 화요일 오전 3:29
     
     
    no i am running excel in the background to handle the math the PowerPoint acts as a user interface with controls to run macro code in excel and return an external action to a com port.    
  • 2012년 4월 24일 화요일 오전 9:27
    중재자
     
     

    Hi,

    I'm afraid people need to run macro visually, in other words, macros could not run without Excel Open.  Think about running macro in background, it could raise potential security concern.

    Another attempt to similar scenario: http://forums.asp.net/t/1454168.aspx

    best regards,


    Forrest Guo | MSDN Community Support | Feedback to manager

  • 2012년 4월 27일 금요일 오전 8:26
     
     
    no i need excel open but i don't want the user getting to the sheets or code excel is used for the math display is done in PowerPoint i pass instructions from PowerPoint to excel then they are passed back to the user by a light going on or a change in the slide some times both. 
  • 2012년 5월 2일 수요일 오전 8:30
    중재자
     
     답변됨

    Hi,

    Your question falls into the paid support category which requires a more in-depth level of support. Please visit the below link to see the various paid support options that are available to better meet your needs.

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    best regards,



    Forrest Guo | MSDN Community Support | Feedback to manager

    • 답변으로 표시됨 ianlynk 2012년 5월 10일 목요일 오전 9:30
    •