Microsoft KB Archive/250385

From BetaArchive Wiki
Knowledge Base

PPT97: Cannot Embed MIDI Files into a Presentation

Article ID: 250385

Article Last Modified on 6/17/2005


  • Microsoft PowerPoint 97 Standard Edition

This article was previously published under Q250385


When you insert a MIDI (.mid) file into a PowerPoint presentation, the file is not embedded into the file structure. Instead an "implied link" is created to the location of the MIDI file.

If the MIDI file is in the same directory as the presentation, the link is stored using only the file name. When PowerPoint loads the file, it searches the same directory where the presentation is located. If the MIDI file is located in another directory, then a fully qualified file path will be created to link to the file.


You cannot edit the link to the MIDI file through the Links dialog box. You can only modify it with a Visual Basic for Applications (VBA) macro.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following code sample requires that you select the MIDI file before you run the macro. You will be prompted with a dialog box that has the current path for the MIDI file. Just type the path to the new location, and press OK.

Sub MIDIpath()
   On Error GoTo ErrorHandler ' Enable error-handling routine.
   Dim strCurrentLocation As String
   Dim strNewLocation As String
   ' This requires that you have selected a MIDI file 
   ' before running this macro
   With ActiveWindow.Selection.ShapeRange
      ' Save the current settings for the file's location
      strCurrentLocation = .LinkFormat.SourceFullName
      ' Get the new location for the file.
      strNewLocation = InputBox("Enter in new MIDI File Location", _ 
      ' If the strNewLocation is not empty, then assign
      ' it to SourceFullName.
      ' NOTE: This does not check to see if the file is
      ' actually in the location specified.
      If strNewLocation <> "" Then 
         .LinkFormat.SourceFullName = strNewLocation
      End If
   End With
Exit Sub ' Exit the subroutine to avoid the error handler.

ErrorHandler: ' Error-handling routine.
   ' Let the user know that no MIDI file was selected.
   MsgBox "No MIDI file has been selected." & vbNewLine & _
   "Please select a MIDI file icon and run this macro again."
End Sub


For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

173707 OFF97: How to Run Sample Code from Knowledge Base Articles

Additional query words: change move linking files midid music howto get ppt ppt97 powerpnt

Keywords: kbhowto kbui kbprb kbmm KB250385