|
APIでマウスカーソルの座標を取得して、
アクティブウィンドウの位置を移動しては如何でしょうか?
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
UserForm1.Show
End Sub
Private Sub UserForm_Activate()
Dim Poi As POINTAPI
Dim hwnd As Long
GetCursorPos Poi
hwnd = GetActiveWindow()
MoveWindow hwnd, Poi.X, Poi.Y, 100, 200, 1
End Sub
−API宣言−
Public Declare Function MoveWindow Lib "user32" _
(ByVal hwnd As Long, ByVal X As Long, ByVal Y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) _
As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function GetActiveWindow Lib "user32" () As Long
Public Type POINTAPI
X As Long
Y As Long
End Type
|
|