Compile Error after upgrading to 64 bit

graemeal

Active Member
Joined
May 17, 2007
Messages
316
Platform
  1. Windows
I have just upgraded to windows 7 64 bit and Excel 2010 64 bit. When I open my files from excel 2007 I get this error. Compile error: The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute. In the first code that pops up it has highlighted the Function word at the top.

I have no idea what to do.

Thanks

Code:
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
 
Private Sub Worksheet_Calculate()
Const FName1 As String = "C:\WINDOWS\Media\ding.wav"
Const FName2 As String = "C:\WINDOWS\Media\beep-3.wav"
Const FName3 As String = "C:\WINDOWS\Media\ringout.wav"
Dim h As Range
For Each h In Range("AB2:AB1872")
    If h.Value > 1 Then
        Call PlaySound(FName1, 0&, SND_SYNC Or SND_FILENAME)
        Exit For
    End If
Next h
For Each k In Range("AC2:AC1872")
    If k.Value < -1 Then
        Call PlaySound(FName1, 0&, SND_SYNC Or SND_FILENAME)
        Exit For
    End If
Next k
For Each i In Range("U2:U15")
    If i.Value > 10 Then
        Call PlaySound(FName2, 0&, SND_SYNC Or SND_FILENAME)
        Exit For
    End If
Next i
For Each j In Range("O2:O1872")
    If j.Value > 35 Then
        Call PlaySound(FName3, 0&, SND_SYNC Or SND_FILENAME)
        Exit For
    End If
Next j
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top