1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Sub testX()
With ActiveWindow
Z = .Zoom / 100
ppx = (.ActivePane.PointsToScreenPixelsY(3) - .ActivePane.PointsToScreenPixelsY(0)) / 3
SetCursorPos .ActivePane.PointsToScreenPixelsX([c3].Left), .ActivePane.PointsToScreenPixelsY([c3].Top)
x = .ActivePane.PointsToScreenPixelsX([d3].Left)
y = .ActivePane.PointsToScreenPixelsY([d3].Top)
End With
With UserForm1
.Show 0
SetWindowPos FindWindow(vbNullString, UserForm1.Caption), 0, x + 7, y + 7, .Width * ppx / Z, .Height * ppx / Z, 0
End With
End Sub |
Partager