Excel vba 32
64: Compile Error The code in this project must be
updated for use on 64-bit systems
Fehlermeldung
'Compile 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.
|
Problem
Wenn man in Excel,
Word, Powerpoint Anwendungen unter der makro-Programmierung (vba) externe
Windows-Funktionen einbindet, dann kommt es zu einer Fehlermeldung, da die
Deklaration/benennung von Funktionen in der neuen 64-Bit Welt anders definiert
sein muss.
Dabei muss
das Wort PtrSafe bei 64-Bit Office verwendet werden.
Das
Betriebssystem Windows 7, 8 oder Windows 10 spielt dabei keine Rolle, sondern
nur, ob das installierte Office Paket als 32 bit oder 64 bit Version installiert
ist
Status:
Noch nicht
gelöst
Konflikt in
Office anpassen?
In den Entwickler-Foren
und unter Microsoft wird empfohlen, mit einer „#If VBA7 then“ Fallunterscheidung die Kompilierung anzupassen.
Leider sind
hier die Online Empfehlungen in Foren und Microsoft nicht zielführend.
in der Entwicklungsumgebung
müsste man in Menü->Extras->Optionen->Editor
die
Automatische Syntaxüberprüfung zusätzlich ausschalten. Dann würde die
eigentliche Hilfsfunktion für Entwickler allerdings auch wegfallen.
Fehler bei
Deklaration von Windows Funktionen wie Sleep und Wait oder Task Thread Aufgaben
Option
Explicit
'Win64
#If VBA7
Then
'--< Office 64-bit >--
'Declare PtrSafe Sub...
Declare PtrSafe Function SetTimer Lib
"USER32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse
As Long, ByVal lpTimerFunc As Long) As Long
Declare PtrSafe Function KillTimer Lib
"USER32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
'--</ Office 64-bit >--
#Else
'--< Office 32-bit >--
'Declare Sub...
Declare Function SetTimer Lib
"USER32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse
As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib
"USER32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
'--</ Office 32-bit >--
#End If
|
Aber auch
bei ausgeschalteter Syntaxüberprüfung
Bleibt leider
die rote Markierung an