Embed pictures and sound that show when needed

  • Thread starter Joe_Hunt via OfficeKB.com
  • Start date
J

Joe_Hunt via OfficeKB.com

I want to do something that I've never done before, and I'm hoping someone
can help me with it. I'm helping a friend that's having a charity fundraiser
with a spreadsheet that he'll show with a projector on a wall. As donations
are made a thermometer sort of graphic will slowly edge up to the goal
(actually I just used conditional formatting for that). Different area
leaders turn in their donations and they're recorded by area in the proper
cells (there's a running total in cell H2), and as certain milestones are
reached I'd like for a .wav file to play, and maybe a graphic of a partying
guy to show for a few seconds just to keep it light. I already have the clip
art and .wav file, and I assume I put them on another worksheet until needed?
If it matters the goal is $200,000, and I'd like for the clapping and graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

Joe_Hunt via OfficeKB.com

Wow, those beat the fire out of what I came up with for a thermometer. Thanks!
That'll look great as a graphic. I've been experimenting with the sound but
with no success yet.
Hi Joe
You can start with this :
http://www.andypope.info/charts/thermometer.htm.
HTH
John
I want to do something that I've never done before, and I'm hoping someone
can help me with it. I'm helping a friend that's having a charity fundraiser
[quoted text clipped - 8 lines]
If it matters the goal is $200,000, and I'd like for the clapping and graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

John

Hi again
To incorporate sound, go to > Insert > Object > Select "Create from File" Tab,
press the browse button and go find your wave file.
You will need VBA codes to program the start.
HTH
John

Joe_Hunt via OfficeKB.com said:
Wow, those beat the fire out of what I came up with for a thermometer. Thanks!
That'll look great as a graphic. I've been experimenting with the sound but
with no success yet.
Hi Joe
You can start with this :
http://www.andypope.info/charts/thermometer.htm.
HTH
John
I want to do something that I've never done before, and I'm hoping someone
can help me with it. I'm helping a friend that's having a charity fundraiser
[quoted text clipped - 8 lines]
If it matters the goal is $200,000, and I'd like for the clapping and
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

John

Hi Joe
Here is some code that may work for you.
Will need more details.
-----------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B2") >= "25000" Then
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
End If
End Sub
--------------------
HTH
John

Joe_Hunt via OfficeKB.com said:
Wow, those beat the fire out of what I came up with for a thermometer. Thanks!
That'll look great as a graphic. I've been experimenting with the sound but
with no success yet.
Hi Joe
You can start with this :
http://www.andypope.info/charts/thermometer.htm.
HTH
John
I want to do something that I've never done before, and I'm hoping someone
can help me with it. I'm helping a friend that's having a charity fundraiser
[quoted text clipped - 8 lines]
If it matters the goal is $200,000, and I'd like for the clapping and
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

Joe_Hunt via OfficeKB.com

Thank you John. I've pulled in two wav files to play with, one is entitled
"tada.wav" and the other I renamed to "clap.wav". I changed the name in the
coding from Object 1 to tada.wav and it wouldn't work. Just so you'll know
what I'm doing, there are 60 odd "camps" that are on the spreadsheet, that
are divided into 7 areas. There's a totals box in cell H2 that totals the 7
areas. We wouldn't want it to play a sound every time there's a change in the
cell, or it would be going off 60 odd times, which could get to be a little
too much. If that's too much of an issue just going off when and if it hits
the goal would be fine.
Hi Joe
Here is some code that may work for you.
Will need more details.
-----------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B2") >= "25000" Then
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
End If
End Sub
--------------------
HTH
John
Wow, those beat the fire out of what I came up with for a thermometer. Thanks!
That'll look great as a graphic. I've been experimenting with the sound but
[quoted text clipped - 11 lines]
 
J

John

Joe
Object1 is the player not the song, you can see that on the top left window
above the first cell A.
If you followed the instruction I sent you and type 25000 or more in cell B2,
the wav file should play.
This is just for testing I know you'll need more code.
Now if you replace Object1 and start new, it will be Object2, check in the
window above "A" then change the macro.
Good Luck
John

Joe_Hunt via OfficeKB.com said:
Thank you John. I've pulled in two wav files to play with, one is entitled
"tada.wav" and the other I renamed to "clap.wav". I changed the name in the
coding from Object 1 to tada.wav and it wouldn't work. Just so you'll know
what I'm doing, there are 60 odd "camps" that are on the spreadsheet, that
are divided into 7 areas. There's a totals box in cell H2 that totals the 7
areas. We wouldn't want it to play a sound every time there's a change in the
cell, or it would be going off 60 odd times, which could get to be a little
too much. If that's too much of an issue just going off when and if it hits
the goal would be fine.
Hi Joe
Here is some code that may work for you.
Will need more details.
-----------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B2") >= "25000" Then
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
End If
End Sub
--------------------
HTH
John
Wow, those beat the fire out of what I came up with for a thermometer.
Thanks!
That'll look great as a graphic. I've been experimenting with the sound but
[quoted text clipped - 11 lines]
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

Joe_Hunt via OfficeKB.com

That's terrific! Thanks! I'll play with it some to get some fireworks or
something going off. I do appreciate it!
Joe
Object1 is the player not the song, you can see that on the top left window
above the first cell A.
If you followed the instruction I sent you and type 25000 or more in cell B2,
the wav file should play.
This is just for testing I know you'll need more code.
Now if you replace Object1 and start new, it will be Object2, check in the
window above "A" then change the macro.
Good Luck
John
Thank you John. I've pulled in two wav files to play with, one is entitled
"tada.wav" and the other I renamed to "clap.wav". I changed the name in the
[quoted text clipped - 26 lines]
 
J

John

Hi Joe
If you have a formula in H2 (SUM) then try this one.
Take note, I have two different songs. Object 1 and Object 2, you can have
more if you like, also
I set the numbers to 25000 and 35000, that too can be changed.
I'm new to programming and I'm sure it could be done better.
This one won't work if you type directly in the cell, it must recalculate to
work.
Private Sub Worksheet_Calculate()
Dim quantity As Double
Select Case Range("H2")
Case 25000
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
Case 35000
ActiveSheet.Shapes("Object 2").Select
Selection.Verb Verb:=xlPrimary
End Select
End Sub
HTH
John

Joe_Hunt via OfficeKB.com said:
That's terrific! Thanks! I'll play with it some to get some fireworks or
something going off. I do appreciate it!
Joe
Object1 is the player not the song, you can see that on the top left window
above the first cell A.
If you followed the instruction I sent you and type 25000 or more in cell B2,
the wav file should play.
This is just for testing I know you'll need more code.
Now if you replace Object1 and start new, it will be Object2, check in the
window above "A" then change the macro.
Good Luck
John
Thank you John. I've pulled in two wav files to play with, one is entitled
"tada.wav" and the other I renamed to "clap.wav". I changed the name in the
[quoted text clipped - 26 lines]
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

Joe_Hunt via OfficeKB.com

That's terrific. Thank you very much!
Hi Joe
If you have a formula in H2 (SUM) then try this one.
Take note, I have two different songs. Object 1 and Object 2, you can have
more if you like, also
I set the numbers to 25000 and 35000, that too can be changed.
I'm new to programming and I'm sure it could be done better.
This one won't work if you type directly in the cell, it must recalculate to
work.
Private Sub Worksheet_Calculate()
Dim quantity As Double
Select Case Range("H2")
Case 25000
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
Case 35000
ActiveSheet.Shapes("Object 2").Select
Selection.Verb Verb:=xlPrimary
End Select
End Sub
HTH
John
That's terrific! Thanks! I'll play with it some to get some fireworks or
something going off. I do appreciate it!
[quoted text clipped - 15 lines]
 
P

Peter T

You could try something like this

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" ( _
ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000

Sub test()
Dim sPath As String, sWavFile As String

sPath = ThisWorkbook.Path & "\" ' or some other path
sWavFile = "myTune.wav"

PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME

Call PlaySound(sPath & sWavFile, 0, SND_ASYNC Or SND_FILENAME)

End Sub

Regards,
Peter T

Joe_Hunt via OfficeKB.com said:
Wow, those beat the fire out of what I came up with for a thermometer.
Thanks!
That'll look great as a graphic. I've been experimenting with the sound
but
with no success yet.
Hi Joe
You can start with this :
http://www.andypope.info/charts/thermometer.htm.
HTH
John
I want to do something that I've never done before, and I'm hoping
someone
can help me with it. I'm helping a friend that's having a charity
fundraiser
[quoted text clipped - 8 lines]
If it matters the goal is $200,000, and I'd like for the clapping and
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

John

Hi Joe
If you're getting a warning message before it starts to play, use this instead.
I just added 2 lines.
Private Sub Worksheet_Calculate()
Dim quantity As Double
Application.DisplayAlerts = False
Select Case Range("H2")
Case 25000
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
Case 50000
ActiveSheet.Shapes("Object 2").Select
Selection.Verb Verb:=xlPrimary
End Select
Application.DisplayAlerts = True
End Sub
HTH
John
Joe_Hunt via OfficeKB.com said:
That's terrific. Thank you very much!
Hi Joe
If you have a formula in H2 (SUM) then try this one.
Take note, I have two different songs. Object 1 and Object 2, you can have
more if you like, also
I set the numbers to 25000 and 35000, that too can be changed.
I'm new to programming and I'm sure it could be done better.
This one won't work if you type directly in the cell, it must recalculate to
work.
Private Sub Worksheet_Calculate()
Dim quantity As Double
Select Case Range("H2")
Case 25000
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
Case 35000
ActiveSheet.Shapes("Object 2").Select
Selection.Verb Verb:=xlPrimary
End Select
End Sub
HTH
John
That's terrific! Thanks! I'll play with it some to get some fireworks or
something going off. I do appreciate it!
[quoted text clipped - 15 lines]
graphic
to show at maybe every $25,000. I really appreciate the help.
 
J

John

Hi Joe
I tried Peter T and modified it to play with your numbers. It's better then mine
because you don't have the Media player opening.
HTH
John
Joe_Hunt via OfficeKB.com said:
That's terrific. Thank you very much!
Hi Joe
If you have a formula in H2 (SUM) then try this one.
Take note, I have two different songs. Object 1 and Object 2, you can have
more if you like, also
I set the numbers to 25000 and 35000, that too can be changed.
I'm new to programming and I'm sure it could be done better.
This one won't work if you type directly in the cell, it must recalculate to
work.
Private Sub Worksheet_Calculate()
Dim quantity As Double
Select Case Range("H2")
Case 25000
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
Case 35000
ActiveSheet.Shapes("Object 2").Select
Selection.Verb Verb:=xlPrimary
End Select
End Sub
HTH
John
That's terrific! Thanks! I'll play with it some to get some fireworks or
something going off. I do appreciate it!
[quoted text clipped - 15 lines]
graphic
to show at maybe every $25,000. I really appreciate the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top