Play any audio file using VBA Excel

前端 未结 5 1630
独厮守ぢ
独厮守ぢ 2021-01-26 20:52

I have a piece of code which can read most audio files (including wav, mp3, midi...), but it won\'t work if there are spaces in the path or File name.

so I have to revert

5条回答
  •  独厮守ぢ
    2021-01-26 21:31

    Try:

    Public Sub Sound2(ByVal File$)
    
    If InStr(1, File, " ") > 0 Then File = """" & File & """"
    
    sMusicFile = File
    
    ...
    

    This will wrap the path in quotes if there is a space, which is required for some API functions.

提交回复
热议问题