用VB调动EXCEC窗体的问题
各位大师好,我想用vB调动excel中的窗体并关闭,不会写代吗,劳驾大师帮忙,在此深表谢意,
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_SYSCOMMAND As Integer = &H112
Const SC_CLOSE As Integer = &HF060
Sub CloseExcel()
Dim i As Long
i = FindWindow("xlmain", vbNullString)
SendMessage i, WM_SYSCOMMAND, SC_CLOSE, 0
End Sub