Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2012, 01:15 AM
tinfanide tinfanide is offline Can pass .expression as a parameter? Windows 7 64bit Can pass .expression as a parameter? Office 2010 32bit
Expert
Can pass .expression as a parameter?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Can pass .expression as a parameter?

I don't know if .expression is the correct term.

I wonder if I can do this:
No error if I put .Shapes.Title in the animations Sub but


error if I pass it as a parameter.
Can it be done?

Code:
Sub test()

'' can't pass .Shapes.Title as a parameter
Call animations(3, .Shapes.Title, msoAnimEffectAppear, msoAnimateTextByAllLevels, msoAnimTriggerOnPageClick, -1, 5, 1, ppAfterEffectHideOnClick)

End Sub

Sub animations(vIndex As Variant, oShape As Shape, oEffectId As MsoAnimEffect, oLevel As MsoAnimateByLevel, oTrigger As MsoAnimTriggerType, lIndex As Long, lDuration As Long, lTriggerDelayTime As Long, oAfterEffect As PpAfterEffect)

With ActivePresentation.Slides(vIndex)
    With .TimeLine.MainSequence.AddEffect( _

'' oShape = .Shapes.Title

        Shape:=oShape, _
        effectId:=oEffectId, _
        Level:=oLevel, _
        trigger:=oTrigger, _
        Index:=lIndex)
        With .Timing
            .Duration = lDuration
            .TriggerDelayTime = lTriggerDelayTime
        End With
        .Shape.AnimationSettings.AfterEffect = oAfterEffect
    End With
End With

End Sub
Thank you.
Reply With Quote
  #2  
Old 12-28-2012, 06:59 AM
Cosmo Cosmo is offline Can pass .expression as a parameter? Windows Vista Can pass .expression as a parameter? Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by tinfanide View Post
I don't know if .expression is the correct term.

I wonder if I can do this:
No error if I put .Shapes.Title in the animations Sub but
error if I pass it as a parameter.
Can it be done?

Code:
Sub test()
 
'' can't pass .Shapes.Title as a parameter
Call animations(3, .Shapes.Title, msoAnimEffectAppear, msoAnimateTextByAllLevels, msoAnimTriggerOnPageClick, -1, 5, 1, ppAfterEffectHideOnClick)
 
End Sub
 
Sub animations(vIndex As Variant, oShape As Shape, oEffectId As MsoAnimEffect, oLevel As MsoAnimateByLevel, oTrigger As MsoAnimTriggerType, lIndex As Long, lDuration As Long, lTriggerDelayTime As Long, oAfterEffect As PpAfterEffect)
 
With ActivePresentation.Slides(vIndex)
    With .TimeLine.MainSequence.AddEffect( _
 
'' oShape = .Shapes.Title
 
        Shape:=oShape, _
        effectId:=oEffectId, _
        Level:=oLevel, _
        trigger:=oTrigger, _
        Index:=lIndex)
        With .Timing
            .Duration = lDuration
            .TriggerDelayTime = lTriggerDelayTime
        End With
        .Shape.AnimationSettings.AfterEffect = oAfterEffect
    End With
End With
 
End Sub
Thank you.
You are not referencing the full object in your 'Test' sub. You cannot use '.shapes...' since you haven't included the part which references 'ActivePresentation.Slides(vIndex)'.

Try this:
Code:
Call animations(3, ActivePresentation.Slides(3).Shapes.Title, msoAnimEffectAppear, msoAnimateTextByAllLevels, msoAnimTriggerOnPageClick, -1, 5, 1, ppAfterEffectHideOnClick)
Reply With Quote
  #3  
Old 12-28-2012, 08:57 AM
tinfanide tinfanide is offline Can pass .expression as a parameter? Windows 7 64bit Can pass .expression as a parameter? Office 2010 32bit
Expert
Can pass .expression as a parameter?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Yes, your example reassures me that it is not possible to use part of the reference. Must use the whole reference instead.
Reply With Quote
  #4  
Old 12-28-2012, 11:36 AM
Cosmo Cosmo is offline Can pass .expression as a parameter? Windows Vista Can pass .expression as a parameter? Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by tinfanide View Post
Yes, your example reassures me that it is not possible to use part of the reference. Must use the whole reference instead.
You can never use only part of a reference - how would it know which slide/presentation/etc you mean?

The reason it works within the animations subroutine is because it is enclosed within your 'With' statement. This is basically shorthand which relieves you from having to type the entire reference each time (and I think it may be slightly faster, as it has already referenced the parent object, but I am not 100% sure about this), but you are still referencing the entire object.

You should be able to do the same in your test routine:

Code:
With ActivePresentation.Slides(vIndex)
Call animations(3, .Shapes.Title, msoAnimEffectAppear, msoAnimateTextByAllLevels, msoAnimTriggerOnPageClick, -1, 5, 1, ppAfterEffectHideOnClick)
end with
Reply With Quote
  #5  
Old 12-28-2012, 06:14 PM
tinfanide tinfanide is offline Can pass .expression as a parameter? Windows 7 64bit Can pass .expression as a parameter? Office 2010 32bit
Expert
Can pass .expression as a parameter?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by Cosmo View Post
You can never use only part of a reference - how would it know which slide/presentation/etc you mean?

The reason it works within the animations subroutine is because it is enclosed within your 'With' statement. This is basically shorthand which relieves you from having to type the entire reference each time (and I think it may be slightly faster, as it has already referenced the parent object, but I am not 100% sure about this), but you are still referencing the entire object.

You should be able to do the same in your test routine:

Code:
With ActivePresentation.Slides(vIndex)
Call animations(3, .Shapes.Title, msoAnimEffectAppear, msoAnimateTextByAllLevels, msoAnimTriggerOnPageClick, -1, 5, 1, ppAfterEffectHideOnClick)
end with
Yes, that's the exact reason. Still referring to the parent object either way.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass parameters to a .msg file? HereNow Outlook 0 11-05-2012 10:38 AM
Office 2010 Excel Full pass raineraus Excel 1 09-19-2012 12:55 PM
Reg expression/ wildcards for mass replacement of contents in table ghumdinger Word Tables 0 07-31-2010 12:21 PM
Can pass .expression as a parameter? Conditional Expression that Moves Data (challenging) themangoagent Excel 1 02-20-2010 11:29 AM
evaluating a text expression in a form field gwp1 Word 0 10-08-2007 02:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft