使用 PowerPoint VBA 检查 Excel 中的数据
Check data in Excel using PowerPoint VBA
我有一个 PowerPoint 演示文稿,其中包含指向 Excel 文件的数据链接,
我正在尝试创建一个无休止的 PowerPoint 循环,每个幻灯片更改都会运行一个宏。此宏需要连接到 Excel 文件,并且如果单元格 B2 > 0 输出导致屏幕上出现动画的动作。
我试图让 PowerPoint 打开 Excel 文件,但我无法做到比这更进一步。
Private Sub OnSlideShowPageChange()
Dim i As Integer
Dim xlApp As Excel.Application
Dim xlWorkBook As Object
Dim Test As Object
'i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
'If i <> i Then Exit Sub
Test = 0
Set xlApp = New Excel.Application
Set xlWorkBook = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Wallboard Test Data.xlsx", True, False)
Set Test = xlWorkBook.sheets("Hall of Fame").Select.Range("B2").Value
MsgBox Test
End Sub
悉达多溃败"Remove .value as Test is an object and then use Msgbox Test.Value . Now you can use Val(Test.Value)>0 for the condition"
我有一个 PowerPoint 演示文稿,其中包含指向 Excel 文件的数据链接,
我正在尝试创建一个无休止的 PowerPoint 循环,每个幻灯片更改都会运行一个宏。此宏需要连接到 Excel 文件,并且如果单元格 B2 > 0 输出导致屏幕上出现动画的动作。
我试图让 PowerPoint 打开 Excel 文件,但我无法做到比这更进一步。
Private Sub OnSlideShowPageChange()
Dim i As Integer
Dim xlApp As Excel.Application
Dim xlWorkBook As Object
Dim Test As Object
'i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
'If i <> i Then Exit Sub
Test = 0
Set xlApp = New Excel.Application
Set xlWorkBook = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Wallboard Test Data.xlsx", True, False)
Set Test = xlWorkBook.sheets("Hall of Fame").Select.Range("B2").Value
MsgBox Test
End Sub
悉达多溃败"Remove .value as Test is an object and then use Msgbox Test.Value . Now you can use Val(Test.Value)>0 for the condition"