embedded wav files

A

ARGT

Is it possible to embed a wav file, used to signal an event, within a
workbook and then be able to take a copy of the excel file and get it to run
(with the sound file) on another computer?

Thanks for any advice.
 
J

Joel

Here is a start. the code below will find the embedded object and play th
etune. You can add the code to a worksheet open function to automatically
play the wav file when the workbook is opened.


Sub Playtune()

For Each obj In ActiveSheet.OLEObjects

'play ole object
obj.Activate

Next obj

End Sub
 
G

Gary''s Student

First insert the wav file like:

Insert > Object... > Create from File > C:\Program Files\Microsoft
Office\OFFICE11\REMINDER.WAV

Then set the trigger. For example, this worksheet event macro will active
the sound if the value 1 is entered in cell A1:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set a1 = Range("A1")
If Intersect(t, a1) Is Nothing Then Exit Sub
If a1.Value <> 1 Then Exit Sub
ActiveSheet.Shapes("Object 1").Select
Selection.Verb Verb:=xlPrimary
a1.Select
End Sub
 
A

ARGT

Thanks Joel and Gary's Student
The advice was just what I needed and it works well.

many thanks
 
A

ARGT

Small problem. The embedding of the wav file worked well with Excel 2003 (on
one PC I use) but just causes Excel 2002 (on another machine) to hang up. It
just shows an insertion box and stops responding. Any ideas?
 
Top