64 bit issue

oozuberk

New Member
Joined
Nov 12, 2019
Messages
3
Hi I'm working in 32 bit Excel but I'm getting error in Excel which is 64 bit. How do I edit the codes in 64 bits.

Public db As DAO.Database
Public rs As DAO.Recordset
Public sql As String
Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Change the API declaration code to:

Rich (BB code):
#If VBA7 Then
Declare PtrSafe Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
#Else 
Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
#End  If
 
Upvote 0
As you said Hello, the code has changed, I get an error in the code. Excel 2013

Set db = OpenDatabase(ActiveWorkbook.FullName, False, False, "Excel 8.0")
Set rs = db.OpenRecordset(sql)
 
Upvote 0
What reference are you using for the DAO? If it's DAO 3.6, that will not work in 64 bit Office. You'll need to replace it with the 'Microsoft Office 15.0 Access database engine Objects' reference.
 
Upvote 0
Glad to help. It's always easy when you know how. ;)
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

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