标题:用VB调动EXCEC窗体的问题
只看楼主
任真
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2019-3-31
结帖率:100%
已结贴  问题点数:20 回复次数:1 
用VB调动EXCEC窗体的问题
各位大师好,我想用vB调动excel中的窗体并关闭,不会写代吗,劳驾大师帮忙,在此深表谢意,
搜索更多相关主题的帖子: VB 窗体 excel 关闭 
2019-04-19 08:19
xyxcc177
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:26
帖 子:197
专家分:1249
注 册:2017-7-8
得分:20 
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
2019-04-19 21:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-494251-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025923 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved