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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

zapperX

New Member
Joined
Jan 14, 2014
Messages
15
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

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,681
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
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,195,663
Messages
6,011,009
Members
441,579
Latest member
satishrazdhan

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
Top