2007 Object Model / parent.parent

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an object model of 2007 out there I can get my hands on? I'd like
to print one out for reference.

ALSO... what happened to the parent.parent object capability. PPT07 dies
every time it runs into that code. Is it broken?

Posting a lot today... thanks!
 
Andy from your lips to MS ears. There is some documentation but its only
about 1/3 of the Object Model. There are promises to update it "soon"...



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com
 
Hi Andy,
Could you post the specific instance where Parent.Parent fails? I've not run
into the issue yet.


--
Regards,
Shyam Pillai

Animation Carbon: Copy/Paste/Share animation libraries.
www.animationcarbon.com
 
Shyam -

I have a class that deals with hyperlinks. All my parent.parent calls are
with hyperlink objects to get the type of the hyperlink - shape or range.

Here is the partial code from that class. Note that I store infromation
about each hyperlink in an array and also store the actual hyperlink object
in that array as well. The code works fine on autoshape and texteffect
objects, ignores placeholder objects (as discussed in the other thread as it
doesn't recognize any links) then dies with a PowerPoint error whenever I add
a TextBox object.

If you need more information I'd be happy to e-mail you my example and the
class we are using from the SlideShowBegin event.

The purpose of this code is to look at each hyperlink and then replace each
one with it's absolute link, if broken, searches for the file and replaces
the hyperlink or marks it as broken (with a symbol). I need to be able to
see what the parent.parent object is to look for white space links (which are
ultimately deleted) or in the case of a broken link, color the object
appropriately.

This is working with a slide show from PowerPoint 2003, in compatiblity
mode. I have not noticed a difference in 2007, but have not tested that
fully yet.

Here is the code snip from the class.

============================
Private Type HyperlinkType
strOriginalAddress As String 'Unmolested address of the link
strOriginalSubAddress As String 'Unmolested SubAddress
strAddress As String 'Working copy link address
strSubAddress As String 'working copy sub address
strFIXAddress As String 'calculated address that should be used (NON SAVE)
strSAVEAddress As String 'corrected address, that should be SAVED
lngCSType As SubAddressType 'Type of custom show type
strCSName As String 'Name of the custom show
hyp As Hyperlink 'The hyperlink in question (full object)
blnValid As Boolean 'True if the link in FIXAddress is valid
strPre As String 'Determined pre-base
sldOn As Slide 'The slide object that the hyperlink lives on
lngType As HyperlinkResolve 'Type of hyperlink
blnIgnore As Boolean 'if true, ignore this link
shpBadLink As Shape 'The shape added to show a bad link
shpHyperlink As Shape 'The shape associated with the hyperlink if applicable
txtrHyperlink As TextRange 'the range associated with the hyperlink as
applicable
blnDelete As Boolean 'if true, then delete the link
strToolTip As String ' What to show to the end user
End Type ' Hyperlink Type

Private mahypAllSlides() As HyperlinkType 'array of all hyperlinks on show
Private msld as Slide 'Generic slide object
Private mPres as Presenation 'The presentation - normally activepres

Private Sub SetNCheckHyperLinks()
Dim hypLink As Hyperlink
Dim shp As Shape
Dim intC As Integer

If Not IsNothing(mPres) Then
'check each slide in the presentation.
intC = 0
For Each msld In mPres.Slides
intC = intC + msld.Hyperlinks.Count
Next msld
ReDim mahypAllSlides(intC)
mintHypSlidesCtr = 0
For Each msld In mPres.Slides
For Each hypLink In msld.Hyperlinks
mintHypSlidesCtr = mintHypSlidesCtr + 1
Set mahypAllSlides(mintHypSlidesCtr).hyp = hypLink
Set mahypAllSlides(mintHypSlidesCtr).sldOn = msld
ParseLink
Next hypLink
Next msld
Else
'do nothing, since no presentation set - should not happen
End If 'mPres = nothing
End Sub 'SetNCheckHyperLinks

-------------------------

I iterate through my hyperlink array and parse each hyperlink (there is more
code here, but not included for clarity)

-------------------------
Private Sub ParseLink()
Dim hypLink As Hyperlink

With mahypAllSlides(mintHypSlidesCtr)
If .hyp.Type = msoHyperlinkRange Then
Set .txtrHyperlink = .hyp.Parent.Parent
ElseIf .hyp.Type = msoHyperlinkShape Then
Set .shpHyperlink = .hyp.Parent.Parent
End If
.blnValid = IsValidLink()
End With
End Sub 'ParseLink



Private Function IsValidLink() As Boolean
Dim objParent As Object
Dim blnIgnoreIt As Boolean 'when true, ignore the link completly.
Dim txtr As TextRange
Dim hypLink As Hyperlink


blnIgnoreIt = False

'parent.parent = Hyperlink->ActionSetting->Shape/TextRange
Set objParent = mahypAllSlides(mintHypSlidesCtr).hyp.Parent.Parent
If TypeName(objParent) = "TextRange" Then
If Trim(objParent) = "" Or Trim(objParent) = vbCrLf Then
blnIgnoreIt = True
End If 'if parent is a return or space
End If 'ignore spaces

<lots more processing>

End Function 'IsValidLink

================================
1. The code dies on "Set objParent =
mahypAllSlides(mintHypSlidesCtr).hyp.Parent.Parent"
2. I can not even look at the mahypAllSlides object in the watch window
because when I expand it, a fatal error is thrown.

3. I will continue to test this and see if I can narrow it down, but I
remember in previous tests that it was the parent.parent object. Perhaps it
has something to do with setting the hyperlink object in an array or possibly
linked to the hyperlink problem you referred to in my other thread. I will
simple this down to determine problems. This is what I have now though.


thanks!!!!

Andy
 
Is there an object model of 2007 out there I can get my hands on? I'd like
to print one out for reference.

ALSO... what happened to the parent.parent object capability. PPT07 dies
every time it runs into that code. Is it broken?

Broken. Known bug. Reported to MS already.
Holding breath waiting for SP1 .... ;-)
 
Thanks Steve -

Any idea when SP1 will be out?

I know we are all busy but do you know if a valid work around would be:
set objA = whatever.parent
set objB = objA.parent

Will that work or is there a larger bug than just parent.parent?

Thanks!

Andy B
 
Thanks Steve -

Any idea when SP1 will be out?

The only thing I know for sure is that not even MS knows for sure. ;-)
I know we are all busy but do you know if a valid work around would be:
set objA = whatever.parent
set objB = objA.parent

Will that work or is there a larger bug than just parent.parent?

Very sneaky workaround, and in at least a quick test, it seems to work.
Nice one.
 
Well, we can only hope it will be soon. I have noticed an increased amount
of general PPT crashes with VBA code, and it seems to run much slower... but
we have a lot of it so I don't know what is causing most of my issues.
Slowly we will fix it.

I'll let you know if that work around holds water in our code. Thanks for
the compliment... even a blind squirrel -- ha.
 
Well, we can only hope it will be soon. I have noticed an increased amount
of general PPT crashes with VBA code, and it seems to run much slower... but
we have a lot of it so I don't know what is causing most of my issues.
Slowly we will fix it.

I'll let you know if that work around holds water in our code. Thanks for
the compliment... even a blind squirrel -- ha.

Please do (and I have plans to try it out here as well, so thanks for the idea again;
it may save me a lot of time).

And please do report anything that reproducibly crashes PPT, especially if you can
demo it with a simple macro or two. One or the other of us will see that it gets to
the right folks at MS. The sooner, the better, the more likely a fix in an SP.
 
Back
Top