Consulting

Results 1 to 4 of 4

Thread: Solved: VBA runtime error 438

  1. #1
    VBAX Regular
    Joined
    Feb 2012
    Posts
    7
    Location

    Solved: VBA runtime error 438

    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:
    [vba]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[/vba]
    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
    [vba]
    Public Sub PutChapterIntoShape(sld1 As Slide) '<-- This does not start

    End Sub[/vba]
    [vba]
    Public Function ReturnChapterPlh(sld As Slide) As Shape
    .... stuff gets done here .....
    Set ReturnChapterPlh = ChapterPlh
    End Function
    [/vba]
    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!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,095
    Location
    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)
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Feb 2012
    Posts
    7
    Location
    Hi John,
    thanks for pointing me!

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

  4. #4
    thnx bro for this......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •