|
とにかくScrollさせたいなら↓の方法で。
Private Declare Function FindWindowExA Lib "User32" _
(ByVal hParent As Long, _
ByVal hChildAfter As Long, _
ByVal lpszClass As String, _
ByVal lpszWindow As String) As Long
Private Declare Function SendMessageA Lib "User32" _
(ByVal Hwnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function GetDlgItem Lib "User32" _
(ByVal Hwnd As Long, _
ByVal nIDDlgItem As Long) As Long
Private Const WM_HSCROLL = &H114&
Private Const WM_VSCROLL = &H115&
Private Const SB_TOP = &H6&
Public Sub ScrollTopLeft()
Dim Hwnd As Long
Hwnd = FindWindowExA(Application.Hwnd, 0&, "XLDESK", vbNullString)
Hwnd = FindWindowExA(Hwnd, 0&, "EXCEL7", vbNullString)
SendMessageA Hwnd, WM_VSCROLL, SB_TOP, GetDlgItem(Hwnd, 2&)
SendMessageA Hwnd, WM_HSCROLL, SB_TOP, GetDlgItem(Hwnd, 4&)
End Sub
なお、C#用にAPIを変換するならこちらが
ご参考になるでしょう。
http://www.pinvoke.net/default.aspx/user32.FindWindowEx
http://www.pinvoke.net/default.aspx/user32.SendMessage
|
|