PDA

View Full Version : Solved: VBA runtime error 438



zxmon21
02-26-2012, 03:37 PM
Hi board,
I write VBA code every now and then and can't seem to beat the following error message

"Runtime error 438 - Object doesn't support this property or method"

Here's the code where the error occurs:
Public Sub PutAllChapterIntoPlaceholder()
Dim RunSld As Slide
For Each RunSld In ActiveWindow.Selection.SlideRange
Debug.Print RunSld.Name
Debug.Print ReturnChapterPlh(RunSld).Name
PutChapterIntoShape (RunSld) '<-- The error occurs here
Next RunSld
End Sub
My guess is that I'm making a mistake calling or defining the PutChapterIntoShape sub. At the same time, ReturnChapterPlh works just as expected.

Here's the code for those two sub/functions

Public Sub PutChapterIntoShape(sld1 As Slide) '<-- This does not start

End Sub

Public Function ReturnChapterPlh(sld As Slide) As Shape
.... stuff gets done here .....
Set ReturnChapterPlh = ChapterPlh
End Function

Can someone point me to what I'm doing wrong with the sub that throws error 438 when I call it?

Thank you very much in advance!

John Wilson
02-27-2012, 02:16 AM
Subs where vars are passed and functions are not called in the same way.

In your case you must EITHER say

PutChapterIntoShape RunSld 'No brackets

OR

Call PutChapterIntoShape (RunSld)

zxmon21
02-27-2012, 02:20 AM
Hi John,
thanks for pointing me!

Just as expected, it's some trivial thing. You changed me from :banghead: to :beerchug:

delete123
03-26-2012, 09:20 AM
thnx bro for this......