Excel 5 및 95에서는 사운드 파일을 사용하여 셀에 메모를 첨부 할 수 있습니다. 이 사운드 노트 칸은 셀 노트 편집을위한 대화 상자를 열어 재생됩니다.

아래 매크로는 셀에 첨부 된 사운드 노트를 재생할 수도 있습니다.

Sub PlaySoundNotesInExcel95(CellAddress As String)

' for Excel 5 and 95 only

If Not Application.CanPlaySounds Then Exit Sub

On Error Resume Next ' in case there is no soundnote

Range(CellAddress).SoundNote.Play

On Error GoTo 0

End Sub

Excel 97 이상은 더 이상 사운드 노트 사용을 지원하지 않습니다.

아래의 매크로를 사용하면 동일한 효과를 얻기위한 해결 방법을 만들 수 있습니다.

Public Declare Function sndPlaySound Lib "winmm.dll" _

Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _

ByVal uFlags As Long) As Long

Sub PlayWavFile(WavFileName As String, Wait As Boolean)

If Dir(WavFileName) = "" Then Exit Sub ' no file to play

If Wait Then ' play sound before running any more code

sndPlaySound WavFileName, 0

Else ' play sound while code is running

sndPlaySound WavFileName, 1

End If

End Sub

Sub PlaySoundNotesInExcel97(CellAddress As String)

' workaround for playing sound notes in Excel 97 or later

Dim SoundFileName As String

SoundFileName = ""

On Error Resume Next ' an error occurs if the cell doesn't have a note

SoundFileName = Range(CellAddress).Comment.Text

On Error GoTo 0

If SoundFileName = "" Then Exit Sub ' no cell note

If InStr(1, SoundFileName, Chr(10)) > 0 Then ' the note contains a line-break

' use the first line as the filename

SoundFileName = Left(SoundFileName, InStr(1, SoundFileName, Chr(10)) - 1)

End If

PlayFileWav SoundFileName, False

End Sub

사운드 노트 생성 방법 :

셀을 마우스 오른쪽 버튼으로 클릭하여 셀 주석을 삽입하고 주석 삽입 …​을 선택합니다.

셀 주석의 첫 번째 문장에서 재생할 사운드 파일의 전체 파일 이름과 경로를 입력합니다 (예 : C : \ 폴더 이름 \ Soundfilename.wav.

사운드 파일 이름 외에 서면 메시지를 추가하려면 파일 이름 뒤에 ENTER 키를 눌러 주석에 새 문장을 만듭니다. 새 문장에 원하는 텍스트를 추가하십시오.

PlaySoundNotesInExcel97 매크로는 이벤트 매크로 Worksheet_SelectionChange ()에 의해 활성화 될 수 있습니다. 이렇게하면 사용자가 사운드 노트로 셀을 활성화 할 때마다 사운드 노트가 재생됩니다.