+ Reply to Thread
Results 1 to 4 of 4

Display Picture & Play Sound for 5 seconds

  1. #1
    Registered User
    Join Date
    09-01-2010
    Location
    Pittsburgh
    MS-Off Ver
    Excel 2003
    Posts
    8

    Display Picture & Play Sound for 5 seconds

    Hi all,

    I have a form that I want to run a macro on that when the user fills in their name in D4 a scary picture and sound are shown and played for 5 seconds and then the table is brought back into view. I've included the report with this posting. I placed the picture to the left of the table. I have not yet purchased the .wav file.

    I am still very new to VBA and have been having a difficult time finding the code for this trick to treat our hard-working field guys on Halloween. Would someone please help me with this code?

    Thanks,
    sisterwolf
    Attached Files Attached Files
    Last edited by sisterwolf; 10-28-2010 at 02:02 PM.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Display Picture & Play Sound for 5 seconds

    This is a rough example of what needs to be done:

    First, create a macro within a module to unload the userform, ie
    Please Login or Register  to view this content.
    Then, in the Userform_Initialize even, place code such as the following:
    Please Login or Register  to view this content.
    Let me know if this helps

  3. #3
    Registered User
    Join Date
    09-01-2010
    Location
    Pittsburgh
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Display Picture & Play Sound for 5 seconds

    Here's a different way I'm trying to show the picture and play sound. I now have the picture on a separate tab and when the user fills out their name, the form tab disappears and the Halloween tab with picture and sound appears for 5 seconds and then the form comes back.

    Questions:
    1- How do I get the code to run automatically? I only know how to get it to work via a button or stepping manually through the code.
    2- How do I embed the .wav sound into the workbook? I've found a few practice sounds and have attached the links at the bottom of the hidden Halloween tab.
    3- What is the proper code for the 5-second timeframe?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-01-2010
    Location
    Pittsburgh
    MS-Off Ver
    Excel 2003
    Posts
    8

    SOLVED: Re: Display Picture & Play Sound for 5 seconds

    Here's the code that worked for anyone interested.

    http://www.vbaexpress.com/forum/show...523#post228523

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1