Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Error 453, Can't find DLL entry point Sleep in kernel32 with VBA call in Office add-in

I have an Office VBA add-in that's causing a problem with one issolated user amongst many others that are not experiencing the the same issue. I've issolated it to the Windows API Sleep function.

This is the declaration I'm using, the 64 bit version coming from official Microsoft documentation (I also tried LongLong instead of Long):

#If VBA6 Then
  ' from Microsoft's Win32API_PtrSage.txt
  Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
  Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

Open in new window


When trying to call this with this example in the same module:

Public Sub TestSleep()
    Sleep 1000
End Sub

Open in new window


This particular user sees this error message:

"453 Can't find DLL entry point Sleep in kernel32"

They are using Office 2016, 32 bit (build 10730) on Windows 10, 64 bit and I have had them check the version of the kernel32.dll which is 10.0.16299.1029, 3/6/2019 (my PC has 10.0.1734.648, 06/03/2019)

What can I do now to establish the cause of the issue and fix it?
Microsoft OfficeWindows OSVBAMicrosoft PowerPointMicrosoft Excel

Avatar of undefined
Last Comment
Jamie Garroch (MVP)

8/22/2022 - Mon
Scott McDaniel (EE MVE )

I don't see anything wrong with you code, and versions really shouldn't make a difference for that dll file.

I'd suspect that your user has some problem with their Windows installation. Not much you can do about that other than suggest a repair/reinstall.

What are you using Sleep for? Just curious, there may be another way which will avoid the use of that call.
ASKER CERTIFIED SOLUTION
ste5an

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jamie Garroch (MVP)

ASKER
Doh. Thanks for that catch ste5an. In the actual add-in, I used thew Win64 test and changed it to VBA7 as a first step. When copying to the issolated test file, I injected this typo. I'm going to retest and see wheat the result is.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes