Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
Ciao Christian,
ho creato un file excel per il controllo di un magazzino all'interno del quale ho creato un piccolo codice VBA che quando richiamato deve emettere un suono e aprire una message box.
Sul mio pc funziona tutto correttamente, ma quando lo uso nel pc da lavoro mi da errore come da immagine.
Il codice che ho scritto è:
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Public Function Allarme()
WAVFile = "c:\windows\media\Windows - Arresto critico.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
MsgBox "Superato il numero di Packaging"
End Function
Grazie a tutti
Prova a sostituire
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
con:
#If VBA7 And Win64 Then
Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As LongPtr, ByVal dwFlags As LongPtr) As LongPtr
#Else
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
#End If
===
Regards,
Norman