+ Reply to Thread
Results 1 to 6 of 6

Audio Alert

  1. #1
    Registered User
    Join Date
    12-07-2008
    Location
    Minnesota
    Posts
    5

    Red face Audio Alert

    Hi all,

    I just discovered VBA coding today and was wondering if I could use it as an audio alert. I found a couple examples online but don’t understand the coding language of excel. I have a feed link from my trading platform to excel that feeds in live data. What I would like to do is have an alert for when Range ("C4").select is >=1000 Alert Ring.wav and when Range ("C4").select is <=-1000 Alert Chimes.wav.

    Please help me get my feet wet with Excel VBA. Much appreciation.

    KyleG.

  2. #2
    Registered User
    Join Date
    12-07-2008
    Location
    Minnesota
    Posts
    5
    I understand this first part:
    Please Login or Register  to view this content.


    But how do I write the code for the two wav file?
    Last edited by royUK; 12-09-2008 at 12:46 PM. Reason: add code tags

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Kyle G,

    Here is the code you need to play the sound conditionally. Change the sound file paths to match their location on your system. They are marked in red.

    Macro to Play a Sound File
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.


    Code to Conditionally Play the Sound
    Please Login or Register  to view this content.
    How to Save a Worksheet Event Macro
    1. Copy the macro using CTRL+C keys.
    2. Open your Workbook and Right Click on the Worksheet's Name Tab for the Worksheet the macro will run on.
    3. Left Click on View Code in the pop up menu.
    4. Paste the macro code using CTRL+V
    5. Make any custom changes to the macro if needed at this time.
    6. Save the macro in your Workbook using CTRL+S

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    12-07-2008
    Location
    Minnesota
    Posts
    5
    Leith,

    Thanks you so much.

    I entered the code in but I keep getting a Ambiguous name detected error. Then it highlights Playsoundfile in gray and Private sub worksheet_change(ByVal target as range) in yellow.

    What does this mean and how can I fix it?

    Thanks once again.

  5. #5
    Registered User
    Join Date
    12-07-2008
    Location
    Minnesota
    Posts
    5
    Leith,

    I got it all square away. Thanks again.

    Kyle G

  6. #6
    Registered User
    Join Date
    08-13-2011
    Location
    toronto, ontario
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: First time VBA coding audio Alert

    Has anyone been able to get this to work? if so please help. I have no VBA experience whatsoever, but i have been able to get the cell to play the sound when i enter a value manually. But i am using a dde feed to get stock quotes and what i need it to do is play the sound when a given cell reaches a certain price. i don't know what i am doing wrong...this is the formula i am using: =playsound,if C4=100 .....thanx for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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