Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Viewing aninmaton files in a WorkBook

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi there. I've got this almost figured out, but now I'm pressed for time

    I need to place an animated GIF (1st choice) or an AVI (second choice) file in a WorkBook so that it will show the animation in full screen, as soon as you open the WorkBook.

    The animation must play once and then "disappear" from view.

    Any pointers to plug-ins, that will do the same, are also welcome.

    Keep Well

    Marcellus

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-02-26 11:29, macj wrote:
    Hi there. I've got this almost figured out, but now I'm pressed for time

    I need to place an animated GIF (1st choice) or an AVI (second choice) file in a WorkBook so that it will show the animation in full screen, as soon as you open the WorkBook.

    The animation must play once and then "disappear" from view.

    Any pointers to plug-ins, that will do the same, are also welcome.

    Keep Well

    Marcellus
    try this

    Option Explicit
    '
    'API and Constant Declarations
    'The function declarations must each be typed on one line.

    Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
    lpstrCommand As String, ByVal lpstrReturnStr As Any, ByVal wReturnLen _
    As Long, ByVal hCallBack As Long) As Long

    Declare Function GetActiveWindow Lib "USER32" () As Integer

    Const WS_CHILD = &H40000000

    Sub PlayAVIFile()

    'Dimension variables.
    Dim CmdStr As String, FileSpec As String
    Dim Ret As Integer, XLSHwnd As Integer

    'The name and location of the AVI file to play.
    FileSpec = "C:AVIFilesE-MailScanemail.avi" 'C:AVIFilesCommconnectmodemld.avi"

    'Get the active sheet's window handle.
    XLSHwnd = GetActiveWindow()

    'Opens the AVIVideo and creates a child window on the sheet
    'where the video will display. "Animation" is the device_id.
    CmdStr = ("open " & FileSpec & _
    " type AVIVideo alias animation parent " & _
    LTrim$(Str$(XLSHwnd)) & " style " & LTrim$(Str$(WS_CHILD)))

    Ret = mciSendString(CmdStr, 0&, 0, 0)

    'Put the AVI window at location 25, 120 relative to the
    'parent window (Microsoft Excel) with a size of 160 x 160.
    Ret = mciSendString("put animation window at 50 240 160 160", _
    0&, 0, 0)

    'The wait tells the MCI command to complete before returning
    'control to the application.
    Ret = mciSendString("play animation wait", 0&, 0, 0)

    'Close windows so they don't crash when you exit the application.
    Ret = mciSendString("close animation", 0&, 0, 0)


    End Sub


    Animated gifs are a little diff....you'll need a ocx control specifically for this..

    You could always try doing the aniimation yourself through code......


    HTH

    Ivan

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    HI Ivan

    I guess that another tip 'o the hat i owe you, best you have a beer on me, i owe you that.

    Rdgs

    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  4. #4
    New Member
    Join Date
    Feb 2002
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Wow!
    You sure are a genius Mr. Ivan!
    This code is sooooo far out of my league, it wants to make me cry...

    The bottom line is that it works!

    Thank you and God bless!

  5. #5
    Board Regular Wil Moosa's Avatar
    Join Date
    Aug 2002
    Location
    Baarlo, the Netherlands
    Posts
    880
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I got the code running and I'm impressed too. Two questions!

    1) While running the code/macro Excel freezes; nothing can be done within Excel. How to overcome this?

    2) How to change the code in such a way that the opening picture and the end picture remain in view?

  6. #6
    Board Regular
    Join Date
    Aug 2002
    Posts
    280
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That is so so cool Mr Ivan Maola
    I want to include this in my project but i cant get it to work in a folder that has a space in the name of the fold eg C:My Projecttest.avi
    Why is it so

  7. #7
    Board Regular
    Join Date
    May 2002
    Location
    Grand Rapids, MI
    Posts
    326
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-11-03 06:04, seacrest wrote:
    That is so so cool Mr Ivan Maola
    I want to include this in my project but i cant get it to work in a folder that has a space in the name of the fold eg C:My Projecttest.avi
    Why is it so
    Ivan's Code is beyond me but does putting a %20 inplace of the space help?

    Derrick Lee Rademaker


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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