VBA coding for macros PlayWav Created 15 years ago2009-06-27 01:55:24 UTC by LeFtY LeFtY

Created 15 years ago2009-06-27 01:55:24 UTC by LeFtY LeFtY

Posted 15 years ago2009-06-27 01:55:24 UTC Post #268973
:\

Can anyone help me? (not realy map related)

I am writing some VBA codes in Excel Macros editor, I want to enable a sound from a button, so far I have come up with this but cant make it work.
I need to know where to point to the WAV file in the text, and where in the work book can I place the WAV file to enable the link?

So Far....
PlayWAV()
WAVFile = "m16.wav"
WAVFile = ThisWorkbook.Path & "\" & WAVFile
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)

Any sugestions?

PM me with your answers if you can and I will bench test them.

Thanks in advance

LeFtY :biggrin:
Posted 15 years ago2009-06-27 14:59:20 UTC Post #268978
Your probably better off going to a forum that was made for the program, as this is a half life forum.

EDIT: Just a note, the general discussion seems like a nice place to put it, but as the name implies, it's for discussion, not really a great place to put questions.
Posted 15 years ago2009-06-27 20:37:55 UTC Post #268981
EDIT: Just a note, the general discussion seems like a nice place to put it, but as the name implies, it's for discussion, not really a great place to put questions.
Yodallydoodlydoo...man,

Thankyou for your anal wisdom I'm sure you will make a great forums moderator one day when you are all grown up :sarcastic:

Until then shut the @#*& up, please view the following...I see questions, do you?
I think you had better be more consistent and go through all threads in the general discussion forum and sniper all question threads....good luck.

Example:
User posted image


So... what you needed to answer was... No LeFtY I do not know how to code VBA but thanks for the challenge, oh and then you would comment on how you are a noob and that LeFtY owns you..... :ninja:
Posted 15 years ago2009-06-27 20:39:44 UTC Post #268982
Thankyou for your anal wisdom i'm sure you will make a great forums moderator one day when you are all grown up
Owned. I have no idea how to help you LeFtY, but good luck.
Posted 15 years ago2009-06-27 20:41:06 UTC Post #268983
Lol, fail.

Anyway, try this code:

[quote] 'This function declaration must be entered onto a single line.
Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Sub PlaySound()
If Application.CanPlaySounds Then
    'Substitute the path and filename of the sound you want to play
    Call sndPlaySound32("c:\win95\media\chimes.wav", 0)
End If
End Sub[/quote]

If this doesn't work, try different code here:
http://www.google.nl/search?hl=nl&q=vba+play+sound&btnG=Google+zoeken&meta=&aq=f&oq=
Posted 15 years ago2009-06-27 21:00:29 UTC Post #268984
I have no idea how to help you LeFtY, but good luck.
Thanks anyway naserve..

Thanks almighty Atom,

I had errors when compiling and could not clear the bug, I have found the solution and nested the .wav file and completed the path, when the button is triggered it plays ok now, thanks again.


LeFtY :)
Posted 15 years ago2009-06-27 22:02:08 UTC Post #268985
Until then shut the @#*& up
Hostility makes you look cool... Er, no?

EDIT: It's funny you can't spend the 2 seconds to spell "fuck"
please view the following...I see questions, do you?
Yes, about shit people would know the fuck about, computer parts, windows, not some fucking foreign programming language.
I think you had better be more consistent
...
go through all threads in the general discussion forum
Not going to happen, sunshine.
what you needed to answer was... No LeFtY I do not know
That message would be considered useless and spam.
how you are a noob and that LeFtY owns you.....
Yeah, sure.
Posted 15 years ago2009-06-28 01:14:17 UTC Post #268991
Yes, about shit people would know the fuck about, computer parts, windows, not some fucking foreign programming language.
Hmmmm anyone else heard of windows Excel (I gotta laugh..sorry)
Not going to happen, sunshine.
Lazy Noob

And yes, I do own you Yodidy, Yodala, oh never mind, I went a fishin and caught me a little fish... Bahahahaha

I thought we was gonna ban people under 9 years old...sheesh

:thefinger:
Posted 15 years ago2009-06-28 01:17:52 UTC Post #268992
Back on topic or this threads getting closed >_>
TheGrimReafer TheGrimReaferADMININATOR
Posted 15 years ago2009-06-28 01:35:08 UTC Post #268995
Close it if you like Grim...

Got my answer from Atom

:heart:
Posted 15 years ago2009-06-28 01:36:13 UTC Post #268996
You got it ;o
TheGrimReafer TheGrimReaferADMININATOR
You must be logged in to post a response.