
Indicates that an argument is not required. The arglist argument has the following syntax and parts: ( LongLong is a valid declared type only on 64-bit platforms.) Data type of the value returned by a Function procedure may be Byte, Boolean, Integer, Long, LongLong, LongPtr, Currency, Single, Double, Decimal (not currently supported), Date, String (variable length only), Variant, a user-defined type, or an object type. List of variables representing arguments that are passed to the procedure when it is called. If ( #) is the first character, all characters that follow must indicate the ordinal number of the procedure's entry point. If the first character is not a number sign ( #), aliasname is the name of the procedure's entry point in the DLL.

VBA DECLARAR API GETWINDOWTEXT OFFICE 2016 CODE
Name of the procedure in the DLL or code resource. Alias is also useful if any characters in the DLL procedure name aren't allowed by the DLL naming convention. You can also use Alias when a DLL procedure has the same name as a public variable, constant, or any other procedure in the same scope. This is useful when the external procedure name is the same as a keyword. Indicates that the procedure being called has another name in the DLL. Name of the DLL or code resource that contains the declared procedure. The Lib clause is required for all declarations. Indicates that a DLL or code resource contains the procedure being declared. Note that DLL entry points are case-sensitive. Indicates that the procedure returns a value that can be used in an expression. Optional (either Sub or Function must appear). Indicates that the procedure doesn't return a value.

The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit versions of Microsoft Office. Used to declare procedures that are available only within the module where the declaration is made. Used to declare procedures that are available to all other procedures in all modules. Declare PtrSafe Function name Lib " libname" ) ] Part Declare PtrSafe Sub name Lib " libname" ) ] Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes).For code to run in 64-bit versions of Microsoft Office, all Declare statements must include the PtrSafe keyword, and all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities must be updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes).


LongPtr: An 8-byte data type which is available only in 64-bit versions of Microsoft Office.Note that you can assign numeric values to it but not numeric types. It is only supported in the VBA 7 runtime on 32-bit and 64-bit. This is the recommended way of declaring a pointer or a handle for new code but also for legacy code if it has to run in the 64-bit version of Office. LongPtr: Variable data type which is a 4-bytes data type on 32-bit versions and an 8-byte data type on 64-bit versions of Microsoft Office.This attribute is mandatory on 64-bit systems. PtrSafe: Shows that the Declare statement is compatible with 64-bits.Without this attribute, using the Declare statement in a 64– bit system will result in a compile-time error. The PtrSafe attribute indicates to the VBA compiler that the Declare statement is targeted for the 64– bit version of Office.
