Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

Powerpoint Access Open Excel Connection

$
0
0

I have coded a macro that opens an excel document and then gets some values from there, the old value is set to a tag in the presentation, if the current data does not match the current tag then it will execute a function and set the tag to the new data.

Once all the above is done it then uses xlApp.Quit to close the excel connection

I want to skip the xlApp.quit step and just access the already open connection instead of opening a new one every slide as this adds a 4 second delay to any animations on screen.

Sub OnSlideShowPageChange()

    ActivePresentation.UpdateLinks

    Dim xlApp As Excel.Application
    Dim xlWorkBook As Object
    Dim Current As Object

    Set xlApp = New Excel.Application
    Set xlWorkBook = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Wallboard Test Data.xlsm", True, False)
    Old = ActivePresentation.Tags("MobileDeal")
    Set Current = xlWorkBook.sheets("Check For GP Change").Range("B9")

    If Old <> Current Then ActivePresentation.Tags.Add "MobileDeal", Current: SendKeys ("{Tab}"): SendKeys ("{Enter}")

    xlApp.Quit
    Set xlApp = Nothing

End Sub

Viewing all articles
Browse latest Browse all 88868

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>