Search notes:

VBA statement: declare

declare sub      subName  lib "some.dll"                   (parameters)
declare sub      subName  lib "some.dll" alias "otherName" (parameters)
declare function funcName lib "some.dll"                   (parameters) as returnType
declare function funcName lib "some.dll" alias "otherName" (parameters) as returnType
declare is needed to locate a procedure or function in a DLL.
In order to be callable from VBA, this procedure or function needs to have the stdcall calling convention.
Don't confuse declare with dim.

ptrSafe

The ptrSafe keyword makes sure that a declare statement can be safely run in a 64-bit environment.
The ptrSafe attribute indicates to the VBA compiler that the declare statement is targeted for a 64-bit version of Office. Without this attribute, using the declare statement in a 64-bit system will result in the compile-time 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.

See also

Accessing and calling DLLs from VBA
VBA statements

Index