Compile error ...updated for use on 64-bit systems

MarkCBB

Active Member
Joined
Apr 12, 2010
Messages
497
Hi there,

I am getting the following error on one of my laptops (MS Excel 2013 All machines)
"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 PrSafe attribute.

below is the code:
Code:
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (lpdwFlags As Long, ByVal dwReserved As Long) As Boolean
Function IEAvailable() As Boolean
Dim IEStat As Long
IEAvailable = (InternetGetConnectedState(IEStat, 0&) <> 0)
End Function
Sub isInternetAvailable()
If IEAvailable = False Then MsgBox "Not connected!"
If IEAvailable = True Then MsgBox "Connected!"
End Sub

Can anyone assist me with this ad explain it to me, do I need to take this type of error into consideration for other Functions?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try this
Code:
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (lpdwFlags As [COLOR=#b22222]int32[/COLOR], ByVal dwReserved As [COLOR=#b22222]int32[/COLOR]) As Boolean

In vb.net, function calls requiring a Long data type need to be declared using int32. The vb editor didn't bark at it, but I don't know if it will run. Worth a shot.
 
Upvote 0
It would be probably be:
Code:
Public Declare PtrSafe Function InternetGetConnectedState Lib "wininet.dll" (lpdwFlags As LongPtr, ByVal dwReserved As Long) As Boolean
Function IEAvailable() As Boolean
Dim IEStat As LongPtr
IEAvailable = (InternetGetConnectedState(IEStat, 0&) <> 0)
End Function
Sub isInternetAvailable()
If IEAvailable = False Then MsgBox "Not connected!"
If IEAvailable = True Then MsgBox "Connected!"
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top