俺想禁用Excel预览窗口中某些按钮,如何做?

intern9901 2007-01-31 12:26:11
如题!谢谢
...全文
267 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
seawolflover 2007-02-02
  • 打赏
  • 举报
回复
其实我也遇到过这个问题,想通过程序控制打印预览里的按钮,但一直没找到。如有人知道请指教。
StarCraftPJF 2007-02-02
  • 打赏
  • 举报
回复
帮顶……
zsj1101 2007-02-02
  • 打赏
  • 举报
回复
楼主看看找的是不是这个
Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function FindWindowExA Lib "user32" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Declare Function GetWindowTextA Lib "user32" (ByVal hwnd As Long, ByVal lpString As String, _
ByVal cch As Long) As Long

Function GetTheHwnd() As Long
Dim XlHwnd As Long
Dim WbHwnd As Long
Dim GText As String
Dim GTextL As Long
XlHwnd = FindWindowA("XLMAIN", vbNullString) '主體窗口句柄
WbHwnd = FindWindowExA(XlHwnd, 0&, "EXCELC", vbNullString) '預覽窗口句柄
GetTheHwnd = FindWindowExA(WbHwnd, ByVal 0&, "Button", vbNullString) '文件窗口句柄
'GetTheHwnd = FindWindowExA(WbHwnd, ByVal 0&, "Button", "縮放(&Z)") '文件窗口句柄
'EnableWindow GetTheHwnd, False
Do While GetTheHwnd > 0
GText = Space(256)
GTextL = GetWindowTextA(GetTheHwnd, GText, 256)
EnableWindow GetTheHwnd, False
If GTextL <> 0 Then Debug.Print GetTheHwnd, Left$(GText, GTextL)
GetTheHwnd = GetWindow(GetTheHwnd, 2) '同級下一個窗口
Loop
End Function
intern9901 2007-02-01
  • 打赏
  • 举报
回复
ChinaOBS 2007-02-01
  • 打赏
  • 举报
回复
稀奇古怪的要求...
shan1119 2007-01-31
  • 打赏
  • 举报
回复
可以吗?我怎么没找到啊

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧