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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,373
Office Version
365, 2019, 2016, 2010
Platform
Windows, 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,373
Office Version
365, 2019, 2016, 2010
Platform
Windows, 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,373
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Glad to help. It's always easy when you know how. ;)
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,110
Messages
5,509,264
Members
408,720
Latest member
Edna123

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top