部分借鉴了网上已有的代码。 Option Explicit Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long Dim Mp3File, LastMp3File As String Private Sub Play() '播放 Mp3File = Application.GetOpenFilename("*.mp3,*.mp3", , "打开mp3文件") If Mp3File = False Then '没有打开任何MP3文件 Mp3File = LastMp3File Exit Sub End If MMStop (LastMp3File) '停止正在播放的MP3文件 LastMp3File = Mp3File MMPlay (Mp3File) Application.StatusBar = "正在播放的文件为:" & Mp3File End Sub Private Sub Play_() '播放指定时间段内的内容 Mp3File = Application.GetOpenFilename("*.mp3,*.mp3", , "打开mp3文件") If Mp3File = False Then '没有打开任何MP3文件 Mp3File = LastMp3File Exit Sub End If MMStop (LastMp3File) '停止正在播放的MP3文件 LastMp3File = Mp3File MMPlay_ (Mp3File) Application.StatusBar = "正在播放的文件为:" & Mp3File End Sub Private Sub StopPLAY() '停止播放 MMStop (Mp3File) Application.StatusBar = "" End Sub Private Sub PausePLAY() '暂停播放 MMPause (Mp3File) End Sub Private Sub ResumePLAY() '继续播放(从暂停处继续播放) MMResume (Mp3File) End Sub Private Function ConvShortFilename(ByVal strLongPath$) As String Dim strShortPath$ If InStr(1, strLongPath, " ") Then strShortPath = String(LenB(strLongPath), Chr(0)) GetShortPathName strLongPath, strShortPath, Len(strShortPath) ConvShortFilename = Left(strShortPath, InStr(1, strShortPath, Chr(0)) - 1) Else ConvShortFilename = strLongPath End If End Function Public Sub MMPlay(ByRef FileName As String) FileName = ConvShortFilename(FileName) mciSendString "close " & FileName, vbNullString, 0, 0 mciSendString "open " & FileName, vbNullString, 0, 0 mciSendString "play " & FileName, vbNullString, 0, 0 End Sub Public Sub MMStop(ByRef FileName As String) mciSendString "stop " & FileName, vbNullString, 0, 0 mciSendString "close " & FileName, vbNullString, 0, 0 End Sub Public Sub MMPause(ByRef FileName As String) mciSendString "pause " & FileName, vbNullString, 0, 0 End Sub Public Sub MMResume(ByRef FileName As String) mciSendString "Resume " & FileName, vbNullString, 0, 0 End Sub Public Sub MMPlay_(ByRef FileName As String) Dim Ret As String * 1024 mciSendString "close " & FileName, vbNullString, 0, 0 mciSendString "open " & FileName, vbNullString, 0, 0 mciSendString "play " & FileName & " from 10000 to 30000", Ret, 1024, 0 End Sub