0
votes

I have a PowerPoint presentation that is has data links to an Excel file,

I am attempting to create an endless PowerPoint loop that every slide change runs a macro. This macro needs to connect to the Excel file, and if cell B2 > 0 output an action that causes an animation on the screen.

I have attempted to make PowerPoint open the Excel file but I have not been able to get further than this.

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
1
it shouldn't be too dificult. which part are you stuck with? Show us the code that you have tried till now. - Siddharth Rout
i have added that - electronduck
Remove .value as Test is an object and then use Msgbox Test.Value. Now you can use Val(Test.Value)>0 for the condition - Siddharth Rout

1 Answers

0
votes

Siddharth Rout "Remove .value as Test is an object and then use Msgbox Test.Value . Now you can use Val(Test.Value)>0 for the condition"