MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Feb 26th, 2002, 12:29 PM   #1
macj
New Member
 
Join Date: Feb 2002
Posts: 3
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
macj is offline   Reply With Quote
Old Feb 27th, 2002, 03:11 AM   #2
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
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
Ivan F Moala is offline   Reply With Quote
Old Feb 27th, 2002, 11:53 AM   #3
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
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"
Jack in the UK is offline   Reply With Quote
Old Feb 27th, 2002, 12:21 PM   #4
macj
New Member
 
Join Date: Feb 2002
Posts: 3
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!
macj is offline   Reply With Quote
Old Nov 3rd, 2002, 06:36 AM   #5
Wil Moosa
Board Regular
 
Wil Moosa's Avatar
 
Join Date: Aug 2002
Location: Maasbree, the Netherlands
Posts: 873
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?
Wil Moosa is offline   Reply With Quote
Old Nov 3rd, 2002, 07:04 AM   #6
seacrest
Board Regular
 
Join Date: Aug 2002
Posts: 250
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
seacrest is offline   Reply With Quote
Old Nov 3rd, 2002, 08:17 AM   #7
technix
Board Regular
 
Join Date: May 2002
Location: Grand Rapids, MI
Posts: 326
Default

Quote:
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

__________________
technix is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes