【发布时间】:2017-03-29 19:18:43
【问题描述】:
我在 Powerpoint 中的 VBA 代码不会“杀死”我的 Excel 应用程序。 如果我查看任务管理器,它仍然会运行。
我想以正确的方式关闭它而不是杀死它。
谁能帮帮我?我已经搜索并试图让它工作,但没有运气。
Public Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow)
If Wn.View.CurrentShowPosition = 2 Then
Dim xlApp As Object
Dim xlWorkBook As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Set xlWorkBook = xlApp.Workbooks.Open("D:\ELE_powerpoint\book1.xlsx", True, False)
With xlWorkBook.ActiveSheet
txt1 = xlWorkBook.sheets(1).Range("A2")
txt2 = xlWorkBook.sheets(1).Range("A3")
txt3 = xlWorkBook.sheets(1).Range("A4")
End With
ActivePresentation.Slides(2).Shapes("a2").TextFrame.TextRange = txt1
ActivePresentation.Slides(2).Shapes("a3").TextFrame.TextRange = txt2
ActivePresentation.Slides(2).Shapes("a4").TextFrame.TextRange = txt3
Set xlApp = Nothing
Set xlWorkBook = Nothing
End If
End Sub
【问题讨论】:
-
xlApp.Quit会做到的
标签: vba excel powerpoint