PDA

View Full Version : [SOLVED:] updating powerpoint



edwin13387
01-12-2017, 01:43 AM
Hello all,

I've run in to a problem with i presentation.


The Set-up:

Excel file one: A data workbook, feeding the powerpoint.

Powerpoint one: A powerpoint, running in kiosk mode. An application, which updates all links in the powerpoint when the 1st slide is opened again, is running in it.

Excel two: A part of the data in excel one is generated by an excel workbook, this uses a macro to send an update every set time(5 min. now)


The issue:

Excel two checks before opening if excel one is read only, if so it does nothing. But powerpoint doesnt, so if it tries to update while excel two is updating it get's stuck.
A solution suggested by another (powerpoint) site, was to make Excel one shared. This made sense, but somehow Excel 2 still locked the file. How can this be


Set wbdata = Workbooks("data grafiek.xlsx")
If wbdata Is Nothing Then Set wbdata = Workbooks.Open("I:\OEE\testbestand\presentatie\data grafiek.xlsx")
If Workbooks("data grafiek.xlsx").ReadOnly = False Then
For Each Sh In wbdata.Sheets
If Sh.Name = "Lab samples" Then
With Sh.Range("B6:E48")
.ClearContents
End With
End If
Next Sh
For Each Sh In Wb.Sheets
If Sh.Name = "Lab samples" Then
With Sh.Range("B6:E48" & Sh.Cells(Rows.Count, 2).End(xlUp).Row)
.Copy Workbooks("data grafiek.xlsx").Sheets(Sh.Name).Cells(Rows.Count, 2).End(xlUp).Offset(1)
End With
End If
Next Sh
wbdata.Close True
End If
wbdata.Close True


Another option would be having a macro for updating the powerpoint, which also checks first if the file is read only. This gives me a lot of issues, simply i can't get it to work.


Sub update()
Dim xlApp As Object
Dim xlWorkBook As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
If xlApp.workbooks.Open("I:\OEE\testbestand\presentatie\test.xlsx").ReadOnly = True Then
MsgBox ("Read Only")
Else
MsgBox ("niet Read Only")
End If
xlApp.workbooks.Close
xlApp.Visible = False
End Sub


This part goes as expected, but after altering the msgbox to an update command like:
Application.Presentations.UpdateLinks or ActiveAplication.UpdateLinks
it doesn't run.
In the attachments is a test version, the extension of the update links test has to be changed back to pptm.
Can this be fixed?

edwin13387
01-17-2017, 07:55 AM
Hello,

with a code that would print the presentation i managed to fix all i needed.


Sub OnSlideShowPageChange()
If elapsed = 0 Then elapsed = Timer
'NOTE this is 15 SECONDS to test for 15 minutes use 900
If Timer > elapsed + 10 Then
elapsed = Timer
Call UpdateLinks
End If
End Sub


Sub OnSlideShowTerminate()
elapsed = 0
End Sub


Sub UpdateLinks()
Dim xlApp As Object
Dim xlWorkBook As Object
Set xlApp = CreateObject("Excel.Application")
' ActivePresentation.SlideShowWindow.View.State = ppSlideShowPaused
' xlApp.Visible = True
If xlApp.workbooks.Open("I:\OEE\testbestand\presentatie\test.xlsx").ReadOnly = True Then
' MsgBox ("Read Only")
xlApp.workbooks.Close
' xlApp.Visible = False
' ActivePresentation.SlideShowWindow.View.State = ppSlideShowRunning
Exit Sub
Else
' MsgBox ("niet Read Only")
With ActivePresentation
.UpdateLinks
End With
End If
xlApp.workbooks.Close
' xlApp.Visible = False
' ActivePresentation.SlideShowWindow.View.State = ppSlideShowRunning
End Sub