How do I insert music in Word so it plays when opened?

K

klowe

I would like to embed music into a Word document so that it will play while
the document is open as one can do throughout the slideshow presentation in
Power Point? Is this possible? If so, how can I do it?
 
J

Jay Freedman

I would like to embed music into a Word document so that it will play while
the document is open as one can do throughout the slideshow presentation in
Power Point? Is this possible? If so, how can I do it?

It is possible, but it has some gotchas if you intend to send the
document to other users.

The first gotcha is that Word requires a macro to play the music
automatically, and many people keep the default setup that prevents
all macros from running, or at least macros that are stored in
documents rather than in templates. That's because nasty people made a
business of sending documents with malicious macro code -- not quite
viruses, since they usually couldn't reproduce themselves, but
destructive. In order to hear the music, recipients will need to set
the macro security level to Medium and click the Enable button in a
dialog that appears when the document opens.

A second one, depending on who's receiving your document, is that some
people won't want to hear your choice of music. For example, I keep my
computer's speakers turned off unless I really want to hear something.

If you can live with those problems, or if you intend to use this
document only on your own computer, the answer is in two steps:

- Open the Insert > Object dialog, click the From File tab, and click
the Browse button to locate the music file. Check the box for "Display
as icon". Leave the "Link to file" box unchecked to embed the music in
the document file.

- Write a macro named AutoOpen (see
http://www.gmayor.com/installing_macro.htm if needed) similar to this
one:

Sub AutoOpen()
On Error GoTo bugout
ActiveDocument.InlineShapes(1).OLEFormat.Activate
bugout:
End Sub

If the music file's icon isn't the first inline shape in the document,
you'll need to change the number from 1 to whatever is appropriate.

If you don't need the music to play automatically, you can omit the
macro and just double-click the icon in the document to start it.
 

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