Shubh Shubh ho !!
I have vba code in a macro enabled file, in MS Office Professional Plus 2019.
When this is opened in LTSC 2021 version of XL, error is displayed and macros cant be run.
From my attempts to understand, it appears that my XL is in 32 bit whereas the target system is a 64bit.
I also understood that we need to use PTRsafe keyword in functions, like
private declare ptrsafe function swe_azalt lib "swedll32.dll" ......
I have only one custom Function in my code, very simple in nature.
From the declare line above, it appears to be referring to a library "swedll32.dll"
And in other examples on the net, there are different libraries being referred to.
Now my question is, how to know which library my code has to refer.
=======================================
My function code is as below.
Function CenterRight(ByVal lMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim rectXL As RECT, rectMsg As RECT
Dim x As Long, y As Long
Dim hMsgbox As Long
If lMsg = HCBT_ACTIVATE Then
hMsgbox = GetActiveWindow
GetWindowRect hXL, rectXL
GetWindowRect wParam, rectMsg
x = (rectXL.Left + (rectXL.Right - rectXL.Left) * 0.9) - _
((rectMsg.Right - rectMsg.Left) / 2)
y = ActiveWindow.Height / 2
SetWindowPos wParam, 0, x, y, 0, 0, _
SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE
UnhookWindowsHookEx hHook
End If
CenterRight = False
End Function
=================================
Is there any thing else to be modified or kept in mind, so that the code can get executed in the target system without errors.
Thanks in advance
Bookmarks