PPT VBA Code working on one computer but not another

Viewed 58

I am wanting to display some information from an excel file in a PPT presentation and have the OLE objects update automatically in slide show view when the presentation restarts. I am doing this to showcase production information in our main office.

So my code seems to work perfectly fine on my desk computer, however, when I put the presentation up on the computer and TV in the prod office it does not run. I have it opening the excel file and refreshing all of the data then saving the file (had to put in a delay so that the excel file could finish refreshing before the save). Next, I have it going through the presentation slides searching for objects and updating them from the excel file. Finally, the workbook and excel application are closed. I have it setup to repeat these steps every time it gets to slide one with the presentation set on a loop.

Frist time ever coding something in PPT and I know some of the commands are different so I just want them to get double checked. Because I am confused as to why it works perfectly on my computer and not the other.

Sub OnSlideShowPageChange()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If i <> 1 Then Exit Sub

Dim xlApp As Object
Dim xlWorkBook As Object

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True

Set xlWorkBook = xlApp.Workbooks.Open("G:\Welding\Daily Updates\Production Info Tracking\TV Display Links.xlsm", True, False)
xlWorkBook.RefreshAll

Dim WAIT As Double
WAIT = Timer
While Timer < WAIT + 5
   DoEvents  'do nothing
Wend

xlWorkBook.Save

For Each sld In ActivePresentation.Slides
    For Each sh In sld.Shapes
        If sh.Type = msoLinkedOLEObject Then
            sh.LinkFormat.Update
        End If
    Next
Next

xlWorkBook.Close
xlApp.Quit

Set xlApp = Nothing
Set xlWorkBook = Nothing

bcheck = True
End Sub
0 Answers
Related