[英]I need to open an excel worksheet while closing an power point application
If some one is going to update the power point they also need to update the excel sheet how to make this happen? 如果有人要更新电源点,他们还需要更新Excel工作表如何做到这一点? I am sure it can be done through macro but i am not good with it.kindly help me out...
我敢肯定它可以通过宏来完成,但是我不擅长。请帮助我...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim strFile As String
Dim WB As Workbook
If ThisWorkbook.Saved = False Then
Dim DirFile As String
DirFile = "C:\Users\tg2412\Documents\1.xlsx"
If Len(Dir(DirFile)) = 0 Then
MsgBox "File does not exist"
Else
Set WB = Workbooks.Open(DirFile)
End If
End If
End Sub
Thanks in advance...:) 提前致谢...:)
You need two things: 您需要两件事:
Your powerpoint needs to handle the presentation close event unless you intend to close it programatically. Powerpoint需要处理演示文稿关闭事件,除非您打算以编程方式关闭它。 If so, skip to the next heading.
如果是这样,请跳到下一个标题。 Powerpoint events are not as straightforward as Excel's.
Powerpoint事件不像Excel那样简单。 Here's a place to start with:
这是一个开始的地方:
http://www.pptfaq.com/FAQ00004_Make_your_VBA_code_in_PowerPoint_respond_to_events.htm http://www.pptfaq.com/FAQ00004_Make_your_VBA_code_in_PowerPoint_respond_to_events.htm
Use Excel application object to launch Excel from Powerpoint: 使用Excel应用程序对象从Powerpoint启动Excel:
Dim Excel As Object
Dim Workbook As Object
Set Excel = CreateObject("Excel.Application")
Excel.Visible = True 'Set this to false if you want Excel to work in the background
'Add more code to verify the path with dir()
Set Workbook = Excel.Workbooks.Open("YourPathHere", True, False)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.