Option Explicit    Private Type RECT    Left As Long    Top As Long    Right As Long    Bottom As Long  End Type    Private Declare PtrSafe Function FindWindow Lib "User32" Alias "FindWindowA" _    (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr    Private Declare PtrSafe Function GetWindowRect Lib "User32" _    (ByVal hWnd As LongPtr, lpRect As RECT) As Long    Private Declare PtrSafe Function GetDesktopWindow Lib "User32" () As LongPtr    Private Declare PtrSafe Function MoveWindow& Lib "User32" _    (ByVal hWnd As LongPtr, ByVal X&, ByVal Y&, ByVal nWidth&, ByVal nHeight&, _    ByVal bRepaint&)    'Прикрепляет окно PDF24 к левому, окно Excel - к правому краю экрана  'PdfName: имя файла без расширения  'SecondsToWait: макс. время ожидания окна PDF24 в секундах  Sub MovePdf24(PdfName As String, SecondsToWait As Byte)    Const TitleSuffix = " - PDF24 Reader"    Dim hPdf As LongPtr, PdfRect As RECT, desktop As RECT, xlRect As RECT    Dim xlHwnd As LongPtr, HalfWidth&, WindowTitle$, spent As Byte    Dim xlWindow As Window    WindowTitle = PdfName & TitleSuffix    spent = 0    Do      hPdf = FindWindow(vbNullString, WindowTitle)      Application.Wait DateAdd("s", 1, Time)      spent = spent + 1    Loop While (hPdf = 0) And (spent < SecondsToWait)    If hPdf = 0 Then      Debug.Print "FindWindow(" & WindowTitle & "): error " & Err.LastDllError      Exit Sub    End If    If GetWindowRect(hPdf, PdfRect) = 0 Then      Debug.Print "GetWindowRect: error " & Err.LastDllError      Exit Sub    End If    GetWindowRect GetDesktopWindow, desktop    HalfWidth = desktop.Right / 2    If MoveWindow(hPdf, desktop.Left, desktop.Top, HalfWidth, desktop.Bottom, 0) = 0 Then      Debug.Print "PDF24 MoveWindow: error " & Err.LastDllError    End If    For Each xlWindow In Application.Windows      xlHwnd = xlWindow.hWnd      If MoveWindow(xlHwnd, HalfWidth, 0, HalfWidth, desktop.Bottom, 0) = 0 Then        Debug.Print "Excel MoveWindow: error " & Err.LastDllError      End If    Next xlWindow  End Sub