VBA300 — Declare missing PtrSafe¶
Severity: 🔴 error Category: platform Phase: 3.3
Description¶
On 64-bit Office (VBA7+) every Declare of a Win32 API entry must carry the PtrSafe attribute. Without it the compiler refuses to load the module.
Failing example¶
Compliant example¶
#If VBA7 Then
Private Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long
#Else
Private Declare Function GetTickCount Lib "kernel32" () As Long
#End If
How to fix¶
Add PtrSafe after Declare. For dual 32/64-bit support wrap in #If VBA7 Then / #Else.
Source: src/rules.py — entry VBA300.