Home > Software design >  MS Word VBA x32 ->x64 conversion, replacement for SetParent?
MS Word VBA x32 ->x64 conversion, replacement for SetParent?

Time:03-01

EDIT: SOLVED

Finally found a code sample and I think it will work (Changing the parent workbook window of an add-in's userform)

I have an old Word document with VBA built in x32 and I need to updated it to work in x64. I've been going through finding the broken x32 declarations and replacing them, but I've having trouble finding a replacement for the following. Can anyone point me in the right direction?

Private Declare Function SetParent Lib "user32.dll" _
(ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Thank you!

CodePudding user response:

Ron de Bruin: Excel Automation is a lifesaver when it comes to converting API calls.

#If VBA7 Then
    Public Declare PtrSafe Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As LongPtr, ByVal hWndNewParent As LongPtr) As LongPtr
#Else
    Private Declare Function SetParent Lib "user32.dll" ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
#End If
  • Related