32 bit VBA on 64 bit pc

Tim_Excel_

Well-known Member
Joined
Jul 12, 2016
Messages
512
Hi forum

I have written my macro on a 32 bit pc. I've added
Code:
#If VBA7 Then
    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
#Else
    Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)
#End If
in order to try and stop excel from asking for a PtrSafe attribute whenever the macro is executed on a 64 bit pc. However, these lines of code simply disappear whenever the file is opened on a 64 bit pc.

Is there any way I can make my file good to go on a 64 bit pc? Could I for example safe it on a 64 bit pc?

Thanks in advance
 
Try sending it straight from Excel just to avoid any possibility of it being the wrong file. As I said I have not heard even a single report of this happening.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I saved the file to a completely different file path, and then emailed it. It is positively the right file I sent.





Then I realised all the time I had been looking at another piece of code. Your solutions work, perfectly. I just did not realise there was another module that needed a PtrSafe attribute.




I have had better days :)
 
Upvote 0
(y) Glad you got it working and of course, Rory is right, it happens all too often:unsure:
 
Upvote 0

Forum statistics

Threads
1,217,359
Messages
6,136,097
Members
449,991
Latest member
IslandofBDA

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