32 bit worked now not on 64

fireslguk

Active Member
Joined
Nov 11, 2005
Messages
295
What do I need to change for this to work on 64 bit guys ?


Option Explicit



'Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _

'bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)



'Private Const KEYEVENTF_KEYUP = &H2

'Private Const VK_SNAPSHOT = &H2C

'Private Const VK_MENU = &H12

'Private Declare PtrSafe Sub Sleep Lib "kernel32.dll" ( _

' ByVal dwMilliseconds As Long)



'

' Public Sub mySleep()

'Do

'Application.Calculate

'ActiveSheet.Unprotect "6477"

'Sheets("MAIN").Range("b1").Value = Now

'ActiveSheet.Protect "6477"

'

' Call Sleep(2000) '2000 Millisekunden Pause

'Loop







'End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
find every DECLARE statement and put a PTRSAFE block to work on either 32 or 64bit:

Code:
#If Win64 Then      'Declare PtrSafe Function
Private Declare PtrSafe  Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare ptrsafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
 
Private Declare ptrsafe Function GetDesktopWindow Lib "user32" () As Long

#Else  'non ptrsafe

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
private    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
private  Declare Function GetDesktopWindow Lib "User32" () As Long

#End If
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,741
Members
449,050
Latest member
excelknuckles

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