Declare PtrSafe Function mciSendString Lib "winmm" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Sub Form_LoadData()
Dim RetString As String * 256
Dim filename As String
Dim iCTR As Long
Dim bits As String * 256
Dim Hz As String * 255
For iCTR = 1 To 2000
filename = Range("I" & iCTR).Value
On Error Resume Next
mciSendString "Open " & Range("B7").Value & "\" & filename & " alias SoundFile", vbNullString, 0, 0&
mciSendString "Set SoundFile time format milliseconds", vbNullString, 0, 0&
mciSendString "Status SoundFile length", RetString, Len(RetString), 0&
mciSendString "Status Soundfile bitspersample", bits, 256, 0&
mciSendString "Status Soundfile bytespersec", Hz, 256, 0&
Range("M" & iCTR) = Str(Hz) / 2
Range("L" & iCTR) = Str(bits)
Range("K" & iCTR) = (RetString) / 1000 'IMPROVEMENT
mciSendString "Close SoundFile", vbNullString, 0, 0&
Next iCTR
For iCTR = 1 To 2000
filename = Range("H" & iCTR).Value
mciSendString "Open " & Range("B9").Value & "\" & filename & " alias SoundFile", vbNullString, 0, 0&
mciSendString "Set SoundFile time format milliseconds", vbNullString, 0, 0&
mciSendString "Status SoundFile length", RetString, Len(RetString), 0&
mciSendString "Status Soundfile bitspersample", bits, 256, 0&
mciSendString "Status Soundfile bytespersec", Hz, 256, 0&
Range("L" & iCTR) = Str(Hz) & " Hz"
Range("K" & iCTR) = Str(bits) & " Bits"
Range("J" & iCTR) = (RetString) / 1000
mciSendString "Close SoundFile", vbNullString, 0, 0&
Next iCTR
End Sub