有关于此的帖子,但似乎我做错了,因为窗口仍在闪烁。这是我的代码的相关部分:
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWndLock As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal ClassName As String, ByVal WindowName As String) As Long
170 oExcel.VBE.MainWindow.Visible = False
180 VBEHwnd = FindWindow("wndclass_desked_gsk", oExcel.VBE.MainWindow.Caption)
190 If VBEHwnd Then LockWindowUpdate VBEHwnd
200 With MB.VBProject.VBComponents(MB.Worksheets(sht.Name).CodeName).CodeModule
210 .InsertLines Line:=.CreateEventProc("Click", printbut.Name) + 1, String:=vbCrLf & "Call Sheet4.printbutton"
220 End With
230 oExcel.VBE.MainWindow.Visible = False
240 LockWindowUpdate 0&
我做错了什么? (该代码基于CPearson的代码)。
感谢您的帮助。
答案 0 :(得分:0)
我已经尝试了所有的东西而无法让它发挥作用。所以我最终使用的另一种选择(不是更可取)是:
170 oExcel.VBE.mainwindow.Visible = False
180 curPos = oExcel.VBE.mainwindow.Left
190 oExcel.VBE.mainwindow.Left = 10000
200 With MB.VBProject.VBComponents(MB.Worksheets(sht.Name).CodeName).CodeModule
210 .InsertLines Line:=.CreateEventProc("Click", printbut.Name) + 1, String:=vbCrLf & "Call Sheet4.printbutton"
220 End With
230 oExcel.VBE.mainwindow.Visible = False
240 oExcel.VBE.mainwindow.Left = curPos