Trigger music if...

Solved
irettigam -  
via55 Posted messages 14392 Registration date   Status Member Last intervention   -
Hello
How to write a macro that would trigger a music or recorded message
for example: if a<>b a recorded message triggers otherwise nothing
I'm on mac
Thanks to all

4 answers

  1. Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
     
    Hi Via,

    It is possible that it works with ITUNES, that the requester takes up my previous post and following the explained procedure draws the player on a sheet.
    If Excel does not crash there is hope, otherwise it will be necessary to go through the Windows Media Player download for Mac

    --
    A+
    Mike-31

    A period of failure is a perfect time to sow the seeds of knowledge.
    1
  2. via55 Posted messages 14392 Registration date   Status Member Last intervention   2 759
     
    Hello

    1° Create a WindowsMediaPlayer object on sheet 1 (Developer tab - Insert - ActiveX Controls - Other controls (icon with tools) - Choose WindowsMediaPlayer from the list and place it on the sheet

    2° Create a macro that plays the music
    ALT+F11 to open the VBA editor then Insert - Module - Copy-paste the following macro:
    Sub music() Sheets(1).WindowsMediaPlayer1.URL = "C:\Users\Public\Music\Sample Music\Kalimba.mp3" End Sub

    Modify the path according to your music file

    3° Create a macro that triggers the music macro when a <> b

    For example, if a is in A1 of sheet1 and b is in B1, place a macro of this style in the worksheet of the sheet (Open the VBA editor and double-click on the sheet in the tree to open the page where you can paste the macro
    Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1") <> Range("B1") Then music End Sub


    Each time A1 or B1 changes, the macro will trigger if the values are different

    Best regards
    Via
    --
    "Imagination is more important than knowledge." A. Einstein
    0
    1. irettigam
       
      Hello and thank you for your explanations.
      Sub music doesn’t work because I’m working on a MAC that doesn’t have Windows Media Player, and on top of that, I’m a real novice in this area!
      If you want to continue the discussion, I thank you in advance.
      0
    2. irettigam
       
      On my MAC there is QUICK TIME PLAYER
      VLC.app
      ITUNES
      to play music or video
      Sending you my schedule would be easier for me, maybe not for you
      The problem is I don't know how to do it!
      0
    3. via55 Posted messages 14392 Registration date   Status Member Last intervention   2 759 > irettigam
       
      Re,

      See Mike's latest response, whom I greet in passing
      Having your file won't teach us more, you either need to download WindowsMediaPlayer for Mac or find the equivalent player in the list of Other controls as Mike explains to you

      Best regards
      Via
      0
    4. irettigam > via55 Posted messages 14392 Registration date   Status Member Last intervention  
       
      I give up
      THANK YOU VERY MUCH for your help but it's too complicated for me
      A thousand apologies
      0
    5. Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
       
      Re,
      you shouldn't give up like that, take a look at my last two posts, but be quick because I'm going on vacation.
      0
  3. Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
     
    Re,

    You can download from this link

    https://www.commentcamarche.net/telecharger/tv-video/23977-windows-media-player/

    but first check if your player is in the list of controls. To do this, open your Excel/developer tab/control module/icon Insert and at the bottom right, you should see an icon represented by a wrench and a crossed hammer on 3 points. Click on it and it will open a list of controls where you should find your media player.
    If you find it, click on it and draw it on your sheet by left-clicking your mouse.
    Then in design mode, when you click on the player you have drawn, its name will appear in the address bar. Please give us this name
    A+
    Mike-31

    A period of failure is a perfect time to sow the seeds of knowledge.
    0
    1. irettigam
       
      Developer tab OK but no control module.
      0
      1. via55 Posted messages 14392 Registration date   Status Member Last intervention   2 759 > irettigam
         
        Hello

        Read my first message again:
        (Developer tab - Insert - ActiveX Controls - Other Controls (icon with tools) - Choose the audio player from the list and place it in the sheet
        Look in the name box for the name assigned to the player
        Replace in the music macro that I mentioned WindowsMediaPlayer1 with the name of your player
        If it doesn't work, you need to download Windows Media Player for Mac as Mike mentioned in his last message.
        0