ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

EXCEL µo¥XÁn­µ

¦^´_ 20# ¦Û§Ú·Pı¨}¦n
§A¬O¦bExcel À³¥Îµ{¦¡ªºVBA

  Call sndPlaySound32(ActiveWorkbook.Path & "\LoadIt.WAV", 0)

TOP

Call sndPlaySound32(ActiveWorkbook.Path & "\LoadIt.WAV", 0)
Call sndPlaySound32(ActiveDocument.Path & "\LoadIt.WAV", 0)

excel¸òword¬O¤£¤@¼Ëªº¡C
¤Ó·PÁ¤F
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

Option Explicit

'API Class to take care of playing the file
Public Declare Function sndPlaySound32 Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
                        ByVal uFlags As Long) As Long

Án­µÀɬOwav
­Y­n¥Împ3
¨º­n«ç¼Ë§ï¡H
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 23# ¦Û§Ú·Pı¨}¦n
´N¦b³o¥DÃD²z

TOP

¦^´_ 24# GBKEE
http://hi.baidu.com/_pt98/item/a65477da91588e36e1f46f17

§ä¨ì³o¨Ç·Q¿ìªk­n¨Ï¥Î¥¦
¨Ï¥ÎwavÀÉ¡AÀɮפӤj¤F¡C¦P¼ËªºÁn­µmp3¥u­n0.1´N°÷¤F


API¼½©ñWAV,AVI,MP3,MID(¨Ó¦Ûºôµ¸)

1.avi

' In standard module:
Public Play As Boolean
Private 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
Private Returnstring As String

Sub AVI_Play()
Const FileName As String = "c:\mybestfile.avi"
If Dir(FileName) = "" Then Exit Sub
If Play Then AVI_Stop
Returnstring = Space(127)
mciSendString "open " & Chr(34) & FileName & Chr(34) _
& " type avivideo alias video", Returnstring, 127, 0
mciSendString "set video time format ms", Returnstring, 127, 0
mciSendString "play video from 0", Returnstring, 127, 0
Play = True
End Sub

Sub AVI_Stop()
mciSendString "close video", Returnstring, 127, 0
Play = False
End Sub

'In ThisWorkbook module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Play Then AVI_Stop
End Sub

2.mp3

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

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)
    FileName = ConvShortFilename(FileName)                            '
    mciSendString "stop " & FileName, vbNullString, 0, 0
    mciSendString "close " & FileName, vbNullString, 0, 0
End Sub

3.wav

Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwflags As Long) As Long

Sub Warning()
  PlaySound ThisWorkbook.Path + "\Warning.wav", 0&, &H1
End Sub

4.mid
Public Declare Function mciExecute Lib "winmm.dll" Alias " mciExecute" (ByVal lpstrCommand As String) As Long

Private Sub play()
Dim ReturnValue As Long
ReturnSoundValue = mciExecute("play C:\WIN95\MEDIA\CANYON.MID")
End Sub
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

§Ú¦³­ÓºÃ°Ý
§Ú¦bvba¸Ì­±¥Î³o­Ó
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Function SndPlay(Pathname As String) As Long
SndPlay = sndPlaySound(Pathname, SND_ASYNC)
End Function

¦ý¬O¥´¶}·|¤@ª½¥s¡Aµ¥¥L¥s§¹¤~¥i¥H¶}©l¨Ï¥Î¡A¬O§Ú­þÃä¼g¿ùÁÙ¬O¯Ê¤F¤°»ò¶Ü?

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD