From: Rob on
I'm working with a PowerPoint presentation where I would like to propogate a slide with Linked Slide Objects. I am able to do this with the below code.
The problem is, I do not know how to do 2 things. 1) Return the object reference (is this .shapes(?)) in order to resize and move the pastespecial objects so they are not overlayed
2) Edit the new shape so that it has a hyperlink "to a place in this document" as the slide just copied. I'm sure I can use the backupindex in some way for this but cannot reference the shape to set the hyperlink. This step is required so that during slide show, the presenter can see the available "backup" slides and click the object to jump to the slide.

' This clears the clipboard to prevent memory problems and is called in the propogate Sub
Private Declare Function OpenClipboard Lib "user32" (ByVal NewOwner As Long) As Boolean
Private Declare Function EmptyClipboard Lib "user32" () As Boolean
Private Declare Function CloseClipboard Lib "user32" () As Boolean

Function ClearClipboard() As Boolean
If OpenClipboard(0) Then
EmptyClipboard
CloseClipboard
End If
End Function


Private Sub propogateBackups_Click()

Dim backupSelectIndex, backupIndex, shapeIndex As Integer

' SlideID 767 is "Backup Slide" selection slide and is used to identify where to begin when creating the pastespecial linked shapes
backupSelectIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex
backupIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex

' My attempt to find the shape index of the newly created object/shape in order to resize and move--this used in a later step--I don't think this works correctly
shapeIndex = ActivePresentation.Slides(backupSelectIndex).Shapes.Count

' Loops for all Backup Slides and adds to Backup Selection Slide
Do
backupIndex = backupIndex + 1
shapeIndex = shapeIndex + 1

With ActivePresentation
.Slides(backupIndex).Copy
.Slides(backupSelectIndex).Shapes.PasteSpecial link:=msoTrue

' This does not work to change size/position--I need help with this
' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings (ppMouseClick)
' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Action = ppActionHyperlink
' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Hyperlink.Address = _
' .Slides(backupIndex)
' ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleHeight
' ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleWidth

End With

' Clear the Clipboard for memory considerations
Call ClearClipboard

' This step identifies a marker slide--all backup slides will be added between this slide and slides(767)
Loop Until ActivePresentation.Slides(backupIndex+1).SlideID = 749


End Sub


Right now this procedure works to copy and pastespecial each slide. But all slides are pasted in the same location and need to be in a 5x4 matrix with slides sized about 100 High, 120 Wide. Then I need to add the Hyperlink to a place in the activepresentation to the appropriate slides(backupIndex) that was just copied.
I know how to do this in the PPT document window wiht the various functions but I want to be able to run this during slide execution or at least run it each time a backup slide is added so that the new slide is part of the linked slides.

Thank you much...I know this isn't an easy problem. I've looked in many places to find a way to do this but cannot find a command or object commands to allow me to do this. I also experimented with creating a Dim currentSlide as slide and couldn't figure out how to modify the needed size/position parameters or then to paste it in the slide. I don't think the linked slide possibility exist (or pastespecial) when I do it that was. So the clipboard .copy and .pastespecial seem like the way to go.
I hope someone can think of a work around or show what I am missing!

Rob



CJ wrote:

Linked Slide Object
13-May-09

I have a PowerPoint 2003 presentation that was given me. It has Quad charts
where 2 of the Quads are linked back to other slides in the presentation. If
you update the full page slides and then right click on the quad and choose
Update Link, the Quad updates.

I can not figure out how this is done so I can duplicate it. When I try to
insert an object - it appears that a New Slide Object can not be linked and
if you try to create a new object from file - you can't insert a presentation
into itself (not to mention how you would go about changing to the actual
slide).

When you look at the Links - the link is shown as the same file name with an
exclamation point and #s behind it.

Any ideas??

Thanks!

EggHeadCafe - Software Developer Portal of Choice
WPF And The Model View View Model Pattern
http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da3425/wpf-and-the-model-view-vi.aspx
From: David Marcovitz on
You are almost there. First, take out this line:

..Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick)

It was supposed to have a With in front of it, but you don't need it because
you are not using the power of the With in here. Without the With, it will
not work, and with the With, you would have to modify a bunch of other
working stuff.

Next, you need something like this:


..Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick) _
.Hyperlink.SubAddress = _
.Slides(backupIndex).SlideID & "," & backupIndex & ","

Because you are linking to a slide within the presentation, you want to play
with the subaddress, not the address of the hyperlink. The subaddress is a
pointer to the slide within the presentation.

Other than that, I think it works.

--David


On 9/25/09 3:32 AM, in article 200992533226randjrisko(a)netzero.net, "<Rob
Risko>" <> wrote:

> I'm working with a PowerPoint presentation where I would like to propogate a
> slide with Linked Slide Objects. I am able to do this with the below code.
> The problem is, I do not know how to do 2 things. 1) Return the object
> reference (is this .shapes(?)) in order to resize and move the pastespecial
> objects so they are not overlayed
> 2) Edit the new shape so that it has a hyperlink "to a place in this document"
> as the slide just copied. I'm sure I can use the backupindex in some way for
> this but cannot reference the shape to set the hyperlink. This step is
> required so that during slide show, the presenter can see the available
> "backup" slides and click the object to jump to the slide.
>
> ' This clears the clipboard to prevent memory problems and is called in the
> propogate Sub
> Private Declare Function OpenClipboard Lib "user32" (ByVal NewOwner As Long)
> As Boolean
> Private Declare Function EmptyClipboard Lib "user32" () As Boolean
> Private Declare Function CloseClipboard Lib "user32" () As Boolean
>
> Function ClearClipboard() As Boolean
> If OpenClipboard(0) Then
> EmptyClipboard
> CloseClipboard
> End If
> End Function
>
>
> Private Sub propogateBackups_Click()
>
> Dim backupSelectIndex, backupIndex, shapeIndex As Integer
>
> ' SlideID 767 is "Backup Slide" selection slide and is used to identify where
> to begin when creating the pastespecial linked shapes
> backupSelectIndex =
> ActivePresentation.Slides.FindBySlideID(767).SlideIndex
> backupIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex
>
> ' My attempt to find the shape index of the newly created object/shape in
> order to resize and move--this used in a later step--I don't think this works
> correctly
> shapeIndex = ActivePresentation.Slides(backupSelectIndex).Shapes.Count
>
> ' Loops for all Backup Slides and adds to Backup Selection Slide
> Do
> backupIndex = backupIndex + 1
> shapeIndex = shapeIndex + 1
>
> With ActivePresentation
> .Slides(backupIndex).Copy
> .Slides(backupSelectIndex).Shapes.PasteSpecial link:=msoTrue
>
> ' This does not work to change size/position--I need help with this
> ' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings
> (ppMouseClick)
> '
> .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Act
> ion = ppActionHyperlink
> '
> .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Hyp
> erlink.Address = _
> ' .Slides(backupIndex)
> '
> ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleHeight
> '
> ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleWidth
>
> End With
>
> ' Clear the Clipboard for memory considerations
> Call ClearClipboard
>
> ' This step identifies a marker slide--all backup slides will be added between
> this slide and slides(767)
> Loop Until ActivePresentation.Slides(backupIndex+1).SlideID = 749
>
>
> End Sub
>
>
> Right now this procedure works to copy and pastespecial each slide. But all
> slides are pasted in the same location and need to be in a 5x4 matrix with
> slides sized about 100 High, 120 Wide. Then I need to add the Hyperlink to a
> place in the activepresentation to the appropriate slides(backupIndex) that
> was just copied.
> I know how to do this in the PPT document window wiht the various functions
> but I want to be able to run this during slide execution or at least run it
> each time a backup slide is added so that the new slide is part of the linked
> slides.
>
> Thank you much...I know this isn't an easy problem. I've looked in many
> places to find a way to do this but cannot find a command or object commands
> to allow me to do this. I also experimented with creating a Dim currentSlide
> as slide and couldn't figure out how to modify the needed size/position
> parameters or then to paste it in the slide. I don't think the linked slide
> possibility exist (or pastespecial) when I do it that was. So the clipboard
> .copy and .pastespecial seem like the way to go.
> I hope someone can think of a work around or show what I am missing!
>
> Rob
>
>
>
> CJ wrote:
>
> Linked Slide Object
> 13-May-09
>
> I have a PowerPoint 2003 presentation that was given me. It has Quad charts
> where 2 of the Quads are linked back to other slides in the presentation. If
> you update the full page slides and then right click on the quad and choose
> Update Link, the Quad updates.
>
> I can not figure out how this is done so I can duplicate it. When I try to
> insert an object - it appears that a New Slide Object can not be linked and
> if you try to create a new object from file - you can't insert a presentation
> into itself (not to mention how you would go about changing to the actual
> slide).
>
> When you look at the Links - the link is shown as the same file name with an
> exclamation point and #s behind it.
>
> Any ideas??
>
> Thanks!
>
> EggHeadCafe - Software Developer Portal of Choice
> WPF And The Model View View Model Pattern
> http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da34
> 25/wpf-and-the-model-view-vi.aspx

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland


From: David Marcovitz on
Oh. One more thing. You had a problem with your scaling. I'm not sure what
you are trying to do there, but the ScaleHeight and ScaleWidth methods need
arguments to tell it how much to scale and whether to scale from the current
size or the original size. Usually, you just lock the aspect ratio and scale
the width, not both the width and the height.

Finally, to move the pictures, you need to deal with the .Top and .Left

Some of this stuff will be obvious if you go to the Debug menu and choose
Compile VBAProject.

--David

On 9/25/09 3:32 AM, in article 200992533226randjrisko(a)netzero.net, "<Rob
Risko>" <> wrote:

> I'm working with a PowerPoint presentation where I would like to propogate a
> slide with Linked Slide Objects. I am able to do this with the below code.
> The problem is, I do not know how to do 2 things. 1) Return the object
> reference (is this .shapes(?)) in order to resize and move the pastespecial
> objects so they are not overlayed
> 2) Edit the new shape so that it has a hyperlink "to a place in this document"
> as the slide just copied. I'm sure I can use the backupindex in some way for
> this but cannot reference the shape to set the hyperlink. This step is
> required so that during slide show, the presenter can see the available
> "backup" slides and click the object to jump to the slide.
>
> ' This clears the clipboard to prevent memory problems and is called in the
> propogate Sub
> Private Declare Function OpenClipboard Lib "user32" (ByVal NewOwner As Long)
> As Boolean
> Private Declare Function EmptyClipboard Lib "user32" () As Boolean
> Private Declare Function CloseClipboard Lib "user32" () As Boolean
>
> Function ClearClipboard() As Boolean
> If OpenClipboard(0) Then
> EmptyClipboard
> CloseClipboard
> End If
> End Function
>
>
> Private Sub propogateBackups_Click()
>
> Dim backupSelectIndex, backupIndex, shapeIndex As Integer
>
> ' SlideID 767 is "Backup Slide" selection slide and is used to identify where
> to begin when creating the pastespecial linked shapes
> backupSelectIndex =
> ActivePresentation.Slides.FindBySlideID(767).SlideIndex
> backupIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex
>
> ' My attempt to find the shape index of the newly created object/shape in
> order to resize and move--this used in a later step--I don't think this works
> correctly
> shapeIndex = ActivePresentation.Slides(backupSelectIndex).Shapes.Count
>
> ' Loops for all Backup Slides and adds to Backup Selection Slide
> Do
> backupIndex = backupIndex + 1
> shapeIndex = shapeIndex + 1
>
> With ActivePresentation
> .Slides(backupIndex).Copy
> .Slides(backupSelectIndex).Shapes.PasteSpecial link:=msoTrue
>
> ' This does not work to change size/position--I need help with this
> ' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings
> (ppMouseClick)
> '
> .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Act
> ion = ppActionHyperlink
> '
> .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Hyp
> erlink.Address = _
> ' .Slides(backupIndex)
> '
> ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleHeight
> '
> ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleWidth
>
> End With
>
> ' Clear the Clipboard for memory considerations
> Call ClearClipboard
>
> ' This step identifies a marker slide--all backup slides will be added between
> this slide and slides(767)
> Loop Until ActivePresentation.Slides(backupIndex+1).SlideID = 749
>
>
> End Sub
>
>
> Right now this procedure works to copy and pastespecial each slide. But all
> slides are pasted in the same location and need to be in a 5x4 matrix with
> slides sized about 100 High, 120 Wide. Then I need to add the Hyperlink to a
> place in the activepresentation to the appropriate slides(backupIndex) that
> was just copied.
> I know how to do this in the PPT document window wiht the various functions
> but I want to be able to run this during slide execution or at least run it
> each time a backup slide is added so that the new slide is part of the linked
> slides.
>
> Thank you much...I know this isn't an easy problem. I've looked in many
> places to find a way to do this but cannot find a command or object commands
> to allow me to do this. I also experimented with creating a Dim currentSlide
> as slide and couldn't figure out how to modify the needed size/position
> parameters or then to paste it in the slide. I don't think the linked slide
> possibility exist (or pastespecial) when I do it that was. So the clipboard
> .copy and .pastespecial seem like the way to go.
> I hope someone can think of a work around or show what I am missing!
>
> Rob
>
>
>
> CJ wrote:
>
> Linked Slide Object
> 13-May-09
>
> I have a PowerPoint 2003 presentation that was given me. It has Quad charts
> where 2 of the Quads are linked back to other slides in the presentation. If
> you update the full page slides and then right click on the quad and choose
> Update Link, the Quad updates.
>
> I can not figure out how this is done so I can duplicate it. When I try to
> insert an object - it appears that a New Slide Object can not be linked and
> if you try to create a new object from file - you can't insert a presentation
> into itself (not to mention how you would go about changing to the actual
> slide).
>
> When you look at the Links - the link is shown as the same file name with an
> exclamation point and #s behind it.
>
> Any ideas??
>
> Thanks!
>
> EggHeadCafe - Software Developer Portal of Choice
> WPF And The Model View View Model Pattern
> http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da34
> 25/wpf-and-the-model-view-vi.aspx

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland


From: James on
Hi

I've just played around with this a bit and come up with a different way
of identifying the slides/shapes which I think is neater. But there are
many ways to skin a cat, so don't take this as the 'right' way of doing
it. It just happens to work for me!

Cheers

James

Sub Backup()

Dim Sl As PowerPoint.Slide
Dim BackUpSlide As PowerPoint.Slide
Dim x As Long
Dim y As Long
Dim myScale As Single
Dim sWidth As Long
Dim sHeight As Long
Dim subStr As String

'grab the proportions of the slide
sWidth = ActivePresentation.PageSetup.SlideWidth
sHeight = ActivePresentation.PageSetup.SlideHeight

'change this slide ref to your back-up slide ref - it currently
grabs the last slide
Set BackUpSlide =
ActivePresentation.Slides(ActivePresentation.Slides.Count)

For Each Sl In ActivePresentation.Slides
'only copy if not the backup slide
If Sl.SlideID <> BackUpSlide.SlideID Then
Sl.Copy
'this is needed for the hyperlink to work correctly (thanks
to David Marcovitz!)
subStr = Sl.SlideID & "," & Sl.SlideNumber & ","
'paste our shape
With BackUpSlide.Shapes.PasteSpecial(ppPasteJPG)
With .ActionSettings(ppMouseClick)
.Action = ppActionHyperlink
.Hyperlink.SubAddress = subStr
End With
'move it around
.Left = x
.Top = y
'size it down so we can get 20 on the slide
.LockAspectRatio = msoTrue
.Width = sWidth / 5
x = x + .Width
'will the next one need wrapping?
If x + .Width > sWidth Then
x = 0
y = y + sHeight / 4
End If
End With
End If
Next
End Sub


Rob Risko wrote:
> I'm working with a PowerPoint presentation where I would like to propogate a slide with Linked Slide Objects. I am able to do this with the below code.
> The problem is, I do not know how to do 2 things. 1) Return the object reference (is this .shapes(?)) in order to resize and move the pastespecial objects so they are not overlayed
> 2) Edit the new shape so that it has a hyperlink "to a place in this document" as the slide just copied. I'm sure I can use the backupindex in some way for this but cannot reference the shape to set the hyperlink. This step is required so that during slide show, the presenter can see the available "backup" slides and click the object to jump to the slide.
>
> ' This clears the clipboard to prevent memory problems and is called in the propogate Sub
> Private Declare Function OpenClipboard Lib "user32" (ByVal NewOwner As Long) As Boolean
> Private Declare Function EmptyClipboard Lib "user32" () As Boolean
> Private Declare Function CloseClipboard Lib "user32" () As Boolean
>
> Function ClearClipboard() As Boolean
> If OpenClipboard(0) Then
> EmptyClipboard
> CloseClipboard
> End If
> End Function
>
>
> Private Sub propogateBackups_Click()
>
> Dim backupSelectIndex, backupIndex, shapeIndex As Integer
>
> ' SlideID 767 is "Backup Slide" selection slide and is used to identify where to begin when creating the pastespecial linked shapes
> backupSelectIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex
> backupIndex = ActivePresentation.Slides.FindBySlideID(767).SlideIndex
>
> ' My attempt to find the shape index of the newly created object/shape in order to resize and move--this used in a later step--I don't think this works correctly
> shapeIndex = ActivePresentation.Slides(backupSelectIndex).Shapes.Count
>
> ' Loops for all Backup Slides and adds to Backup Selection Slide
> Do
> backupIndex = backupIndex + 1
> shapeIndex = shapeIndex + 1
>
> With ActivePresentation
> .Slides(backupIndex).Copy
> .Slides(backupSelectIndex).Shapes.PasteSpecial link:=msoTrue
>
> ' This does not work to change size/position--I need help with this
> ' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings (ppMouseClick)
> ' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Action = ppActionHyperlink
> ' .Slides(backupSelectIndex).Shapes(shapeIndex).ActionSettings(ppMouseClick).Hyperlink.Address = _
> ' .Slides(backupIndex)
> ' ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleHeight
> ' ActivePresentation.Slides(backupSelectIndex).Shapes(shapeIndex).ScaleWidth
>
> End With
>
> ' Clear the Clipboard for memory considerations
> Call ClearClipboard
>
> ' This step identifies a marker slide--all backup slides will be added between this slide and slides(767)
> Loop Until ActivePresentation.Slides(backupIndex+1).SlideID = 749
>
>
> End Sub
>
>
> Right now this procedure works to copy and pastespecial each slide. But all slides are pasted in the same location and need to be in a 5x4 matrix with slides sized about 100 High, 120 Wide. Then I need to add the Hyperlink to a place in the activepresentation to the appropriate slides(backupIndex) that was just copied.
> I know how to do this in the PPT document window wiht the various functions but I want to be able to run this during slide execution or at least run it each time a backup slide is added so that the new slide is part of the linked slides.
>
> Thank you much...I know this isn't an easy problem. I've looked in many places to find a way to do this but cannot find a command or object commands to allow me to do this. I also experimented with creating a Dim currentSlide as slide and couldn't figure out how to modify the needed size/position parameters or then to paste it in the slide. I don't think the linked slide possibility exist (or pastespecial) when I do it that was. So the clipboard .copy and .pastespecial seem like the way to go.
> I hope someone can think of a work around or show what I am missing!
>
> Rob
>
>
>
> CJ wrote:
>
> Linked Slide Object
> 13-May-09
>
> I have a PowerPoint 2003 presentation that was given me. It has Quad charts
> where 2 of the Quads are linked back to other slides in the presentation. If
> you update the full page slides and then right click on the quad and choose
> Update Link, the Quad updates.
>
> I can not figure out how this is done so I can duplicate it. When I try to
> insert an object - it appears that a New Slide Object can not be linked and
> if you try to create a new object from file - you can't insert a presentation
> into itself (not to mention how you would go about changing to the actual
> slide).
>
> When you look at the Links - the link is shown as the same file name with an
> exclamation point and #s behind it.
>
> Any ideas??
>
> Thanks!
>
> EggHeadCafe - Software Developer Portal of Choice
> WPF And The Model View View Model Pattern
> http://www.eggheadcafe.com/tutorials/aspnet/ec832ac7-6e4c-4ea8-81ab-7374d3da3425/wpf-and-the-model-view-vi.aspx
>