If you're not sure which Office product you have, see What version of Office am I using? Otherwise, pick your version of Office from below.
Type | Item | Description |
---|---|---|
Qualifier | PtrSafe | Indicates that the Declare statement is compatible with 64-bits. This attribute is mandatory on 64-bit systems. |
Data Type | LongPtr | A 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 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. It is only supported in the VBA 7 runtime on 32-bit and 64-bit. Note that you can assign numeric values to it but not numeric types. |
Data Type | LongLong | This is an 8-byte data type which is available only in 64-bit versions of Microsoft Office. You can assign numeric values but not numeric types (to avoid truncation). |
Conversion Operator | CLngPtr | Converts a simple expression to a LongPtr data type. |
Conversion Operator | CLngLng | Converts a simple expression to a LongLong data type. |
Function | VarPtr | Variant converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
Function | ObjPtr | Object converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
Function | StrPtr | String converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
Parameter | Description |
---|---|
hKey [in] | A handle to an open registry key. |
lpSubKey [in, optional] | The name of the registry subkey to be opened. |
ulOptions | This parameter is reserved and must be zero. |
samDesired [in] | A mask that specifies the desired access rights to the key. |
phkResult [out] | A pointer to a variable that receives a handle to the opened key. |