Yet another approach is to
store the value that is required between presentations in a custom
document property which is updated whenever the value changes. This
property can then be read from any presentation. The benefit of this
approach is the variable value can be saved between sessions for later
retrieval even in the main presentation itself.
'
--------------------------------------------------------------------------------
' Copyright ©1999-2018, Shyam Pillai, All Rights Reserved.
'
--------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
'
--------------------------------------------------------------------------------
1. Create a routine in the
main presentation which writes the variable value into the document
property whenever required.
Sub UpdateProperty(Index As Integer)
On Error Resume Next With
ActivePresentation.CustomDocumentProperties
.Item(Index:="LastUsedIndex").Delete
.Add Name:="LastUsedIndex", LinkToContent:=msoFalse, _
Type:=msoPropertyTypeNumber, Value:=Index End With
End Sub
2. Use the following function in the 2nd presentation which retrieves for the document property value from 1st presentation. It accepts two arguments - a reference to a presentation and the property to be retrieved from that presentation.
Function GetDocPropertyValue(oPres As Presentation,
PropertyName As String) On Error Resume Next GetDocPropertyValue =
oPres.CustomDocumentProperties(PropertyName) End Function
Top
|