Compile error using PrtSafe in VBA 6.0 with Conditional Compilation

dhsimmons_sl
dhsimmons_sl used Ask the Experts™
on
Can any one help. I receive a compile error when adding PrtSafe to a Declare Function.

The code is:

' Declaration for the DeviceCapabilities function API call.
#If VBA7 Then
        Private Declare PtrSafe Function DeviceCapabilities Lib "winspool.drv" _
            Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _
            ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
            ByVal lpDevMode As Long) As LongLong
#Else
        Declare Function DeviceCapabilities Lib "winspool.drv" _
            Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _
            ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
            ByVal lpDevMode As Long) As Long
#End If

Please don't suggest removing the code. It is an inherited application and do not want to rewrite it.

Modules were created in Access 2007 with VBA 6.5 attempting to run with some users that have Office (Access) 2010 64-bit VBA 7.0.

Thank You
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014
Commented:
This is a bug in the compiler.  I saw it for the first time last Fall.  It drove me nuts, trying to make the conditional compilation work.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial