Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerPoint Animation with VBA 1

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
I posted this in the Office section, but was asked to post here instead.

I have been working on some PowerPoint animation that works like a quiz. A list box has possible answers, and depending on the answer they choose, a textbox has a certain value and color to it. I would also like to animate the text box so it looks slick. Here is the code I have so far:

CODE
Code:
Private Sub ListBox1_Click()
If ListBox1 <> "" Then
answer = ListBox1

If answer = "My Answer 1" Then
txtExample = "That's part right, but there's more!"
txtExample.SpecialEffect = fmBorderStyleSingle
txtExample.ForeColor = RGB(128, 0, 255)
'Color - Purple
txtExample.BackColor = RGB(0, 255, 255)
'Color - Cyan
txtExample.BorderColor = RGB(0, 0, 0)
'Color - Black

ElseIf answer = "My Answer 2" Then
txtExample = "That's kinda sorta right, but there's some more!"
txtExample.SpecialEffect = fmBorderStyleSingle
txtExample.ForeColor = RGB(0, 191, 255)
'Color - Deep Sky Blue
txtExample.BackColor = RGB(173, 255, 47)
'Color - Green Yellow
txtExample.BorderColor = RGB(255, 20, 147)
'Color - Deep Pink

ElseIf answer = "My Answer 3" Then
txtExample = "There's more, but that is part of it!"
txtExample.SpecialEffect = fmBorderStyleSingle
txtExample.ForeColor = RGB(240, 128, 128)
'Color - Light Coral
txtExample.BackColor = RGB(216, 191, 216)
'Color - Thistle
txtExample.BorderColor = RGB(218, 165, 32)
'Color - Goldenrod

ElseIf answer = "My Correct Answer 4" Then
txtExample = "WOHOOOOOO!!!!! You Got it Right!"
txtExample.SpecialEffect = fmBorderStyleSingle
txtExample.ForeColor = RGB(208, 32, 144)
'Color - Violet Red
txtExample.BackColor = RGB(245, 245, 220)
'Color - Beige
txtExample.BorderColor = RGB(0, 250, 154)
'Color - Green
End If
End If
End Sub

All of this works, and now I jsut also want to add a line for each answer like

docmd.animation = fly in left

or

txtExample.entrance = (flyin, Left)
lol
I know that's not right, but I am guessing someone out there might know what would be right. Is there also a list of the vba names for the animations for entrance and emphasis, etc?


Besides this, I am working on the end of the powerpoint, sending an email to a static address letting them know that this user has completed the presentation. I have it working with the following code. The only problem is that Outlook asks for permission to send the email. This is on an internal network, and I really want to put something in the code to trust the email or to say yes to the permission for the user. One big problem is that you are in presentation mode, and the permission box has a habit of going behind the presentation, then you can't see it. Please take a look at the code if you can and let me know if you have any thoughts.

Code:
Private Sub CommandButton1_Click()
Dim objOutlook As Object 'Outlook.Application
Dim objOutlookMsg As Object 'Outlook.MailItem
Dim objOutlookRecip As Object 'Outlook.Recipient

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(0)

With objOutlookMsg
'   Add the To recipient(s) to the message.
    Set objOutlookRecip = .Recipients.Add("me@email.com")
    objOutlookRecip.Type = 1
    ' Set the Subject and Body of the message; save and send message
    .Subject = "Harrassment Presentation Completed"
    ' this could be from a variable if you have one
    .Body = Me.txtExample & " has successfully completed the Presentation on " & Date
    'this was code I tried to trust the email - didn't work
    .Save
'    objMailItem.Save
'Set objSafeMail = CreateObject("Redemption.SafeMailItem")
'objSafeMail.Item = objMailItem
'objSafeMail.Send

    .Send
End With
Set objOutlook = Nothing

End Sub
Thank you!

misscrf

It is never too late to become what you could have been ~ George Eliot
 



Well the VALUE in the textbox has nothing to do with the animation, unless its one of those line-by-line phase-ins.

You can set the animation before the show starts and then load the textbox on the fly from the listbox selection.

I don't know if that will solve your problem or not.

Skip,

[glasses] [red][/red]
[tongue]
 
ok, but how do I set the animation before the show starts? lol what event would I be using?

misscrf

It is never too late to become what you could have been ~ George Eliot
 
OK, I must be confusing things. I want to eventually save this as a pps. It will open when a user launches it, take then through the slides, get to the one with the list box, a user will choose a listbox answer, and.....

misscrf

It is never too late to become what you could have been ~ George Eliot
 



Code:
Private Sub App_PresentationOpen(ByVal Pres As Presentation)
'run your code here
End Sub

Skip,

[glasses] [red][/red]
[tongue]
 



But before you do that, you need to just run the code outside of the slide show, and see if you still get the error or not. It may be a moot point.

Skip,

[glasses] [red][/red]
[tongue]
 
Thanks!

misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top