Moving a textframe by a specific amount

N

Nick

Hi there,

I'm automating PowerPoint and trying to animate a single text frame.
The text frame is much taller than the page but the same width as the page.
I would like to scroll it up from (Y = 50) until all the text has been
shown but am not sure how to setup the behaviors. This is what I currently
have,

pObjSlide.Shapes(1).top = 50
Dim pObjMotionEffect As Object =
pObjSlide.TimeLine.MainSequence.AddEffect(pObjSlide.Shapes(1), _
msoAnimEffectPathUp, _
msoAnimTriggerOnPageClick)
pObjMotionEffect.EffectParameters.Amount = pObjSlide.Shapes(1).Height

Unfortunately the value for Amount isn't accepted, presumably it's too
large. I have also tried the following,

pObjSlide.Shapes(1).top = 50
Dim pObjMotionEffect As Object =
pObjSlide.TimeLine.MainSequence.AddEffect(pObjSlide.Shapes(1), _
msoAnimEffectCustom, _
msoAnimTriggerOnPageClick)
Dim pObjAnimMotion As Object =
pObjMotionEffect.Behaviors.Add(msoAnimTypeMotion)
With pObjAnimMotion.MotionEffect
.FromX = (pObjSlide.Shapes(1).Width / 2)
.FromY = 50 + (pObjSlide.Shapes(1).Height / 2)
.ToX = .FromX
.ToY = (.FromY - pObjSlide.Shapes(1).Height)
End With

I offset the translation point to the centre of the object, presuming
that it translates the coordinates from the center. I have tried
translating from the top left of the object too but the animation just
doesn't work.

Any ideas how I can achieve this effect? Thanks for your time in advance.

Nick.
 
J

\Ji Zhou [MSFT]\

Hello Nick,

This is a quick note to let you know I am still researching on this issue.
I will get back as soon as possible if I have found something.


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

\Ji Zhou [MSFT]\

Hello Nick,

I have found that the scroll height of the text frame has something to do
with the MotionEffect.Path property. The path property is in VML format
like "M 0 0 L 0 -1 E".

It means that Move the point to (0,0) related to the shape, Line to the
point(0,-1). Here 1 means one height of the slide. We can get the slide
height from SliderMaster.Height. So, I use the following codes to achieve
what you want. Hope it will help!

Sub Test()
Dim pObjSlide As Slide
Set pObjSlide = Application.ActivePresentation.Slides(1)

pObjSlide.Shapes(1).Top = 50
Dim pObjMotionEffect As Object
Set pObjMotionEffect =
pObjSlide.TimeLine.MainSequence.AddEffect(pObjSlide.Shapes(1),
msoAnimEffectPathUp, msoAnimateLevelNone, msoAnimTriggerOnPageClick, 1)

Dim slideHeight As Integer
slideHeight = Application.ActivePresentation.SlideMaster.Height

Dim shapeHeight As Integer
shapeHeight = pObjSlide.Shapes(1).Height

Dim pObjAnimMotion As Object
Set pObjAnimMotion = pObjMotionEffect.Behaviors(1)
pObjAnimMotion.MotionEffect.Path = "M 0 0 L 0 " & -(shapeHeight -
slideHeight + 100) / slideHeight & " E"
End Sub

Please let me know if this works for you scenario or not.

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

Nick

Hi again Ji,

Thanks fantastic, I have a working solution now thanks to yourself.
You're a star.

Nick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top