Click a Button, Play a WAV File (for the Dull of Wit)

ProvPC

Board Regular
Joined
Nov 2, 2014
Messages
62
I've been struggling with this seemingly simple operation for two days now, and I just can't seem to get it. I've read and done my best to follow numerous examples given - many within this very forum - and have encountered an extraordinary variety of error messages in the process (and sometimes, no error messages at all, but also no results).

I have a 64-bit version of Excel 2016. I'm trying to create a button that will do two things:
1) Increment the value in a given cell by 1
2) Play a sound. Extra points if this part doesn't necessitate the launch of a separate program, but I'll take what I can get!

The file needs to be portable, but I am not bothered by whether it's easiest to embed the audio file, or to summon it from the same directory the spreadsheet inhabits - whatever you feel works best, I'll be delighted with! I'm just requesting some clear, precise instructions on how to get the silly thing to work. :eek:)

I wish I'd kept a list of all the error messages, but they've included things like needing to optimize and add the PtrSafe function for 64-bit, value undefined, Public declarations not allowed, cannot locate insertion point, and just plain nothing at all (least of all audio!)

Any assistance would be much appreciated!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
On a lark, I started a new workbook, and repeated the steps above on an otherwise empty workbook. Again, the increment updated, but this time there's a "ding" every time I click the button - like an error alert or notice - but nothing appears to show me what the complaint is.
 
Upvote 0
Well... the sound works perfectly on a different PC running a 32-bit version of Excel 2013 , with or without the PrtSafe declaration. I can only assume there's something wrong with the 64-bit part of the declarations? Or something wrong with my version of winmm.dll (which seems unlikely). I have a 64-bit version of Excel 2016.
 
Upvote 0
If it runs on 32-bit Excel, adding PtrSafe to the declaration should allow it to run on the 64-bit version. Is there another machine with the 64-bit version available for test?
 
Upvote 0
If it runs on 32-bit Excel, adding PtrSafe to the declaration should allow it to run on the 64-bit version. Is there another machine with the 64-bit version available for test?
Sadly, there is not - though I'd be willing to upload the workbook somewhere if someone with a 64-bit version of Excel 2016 could test it for me. (And it would be hilarious to discover that this entire time I've been beating my head against the wall because of something OTHER than my poor VBA skills!)
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top