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
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,503
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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
 

oozuberk

New Member
Joined
Nov 12, 2019
Messages
3
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)
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,503
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,503
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Glad to help. It's always easy when you know how. ;)
 

Watch MrExcel Video

Forum statistics

Threads
1,108,860
Messages
5,525,257
Members
409,639
Latest member
nithin49

This Week's Hot Topics

Top