how can I get this code to work on excel where its on a 64bit machine?

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
476
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
When it crashes the error is highlighted on this line:
Code:
Me.Caption = VBA.UCase$([COLOR=#ff0000][B][FONT=arial black]Format[/FONT][/B][/COLOR]$(VBA.Date, "yyyy - mmmm ")) & VBA.Day(VBA.Date) _              
                   & "   (" & VBA.Date & ")"

I changed the declaration from this:
Code:
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer

to this:
Code:
Private Declare PtrSafe Function GetKeyState Lib "user32" (ByVal nVirtKey As LongPtr) As Integer

but it still crashes.

The code is from a datepicker application that I found in order to try and find something other than excels own 'DTPicker' which crashes on 64bit machines.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Ran the macro here Win 10 / 64 bit and it works.

The Caption for UserForm1 shows : 2019 - MARCH 22 (3/22/2019)
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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