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:29no 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
Forrest Guo | MSDN Community Support | Feedback to manager
- 답변으로 표시됨 Forrest GuoMicrosoft Employee, Moderator 2012년 4월 26일 목요일 오전 1:26
- 답변으로 표시 취소됨 ianlynk 2012년 4월 27일 금요일 오전 8:27
-
2012년 4월 27일 금요일 오전 8:26no 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

