I am trying to upgrade my VBA declare statements so they work on 32 and 64 version of office. I'm assuming all the users are on VBA 7 or later. I copied the code below from this forum and it works perfectly but for completeness, should I change the other 'Long' to LongPtr throughout as in the second example?
Private Declare PtrSafe Function MsgBoxTimeOut Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As VbMsgBoxStyle, _
ByVal wlange As Long, ByVal dwTimeout As Long) As Long
Private Declare PtrSafe Function MsgBoxTimeOut Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As VbMsgBoxStyle, _
ByVal wlange As LongPtr, ByVal dwTimeout As LongPtr) As LongPtr
It's an excellent way to pop up a time expiring message and doesn't upset the virus checker.
Thanks.
Private Declare PtrSafe Function MsgBoxTimeOut Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As VbMsgBoxStyle, _
ByVal wlange As Long, ByVal dwTimeout As Long) As Long
Private Declare PtrSafe Function MsgBoxTimeOut Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As LongPtr, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As VbMsgBoxStyle, _
ByVal wlange As LongPtr, ByVal dwTimeout As LongPtr) As LongPtr
It's an excellent way to pop up a time expiring message and doesn't upset the virus checker.
Thanks.