導航:首頁 > 源碼編譯 > vbauserform編譯錯誤

vbauserform編譯錯誤

發布時間:2023-07-09 16:41:15

❶ 打開EXCEL時出現 隱含模塊中的編譯錯誤:UserForm1

Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Const ID = "123"

Private Sub CommandButton1_Click()
If TextBox1 = ID Then
Unload UserForm1
Exit Sub
Else
UserForm1.Height = UserForm1.Height - 30
UserForm1.Width = UserForm1.Width - 30
TextBox1 = ""
TextBox1.SetFocus
End If
If UserForm1.Height < 80 Then
MsgBox "不知道密碼就不要再撐了!按""X""離開吧!"
End If
End Sub

Private Sub CommandButton2_Click()
TextBox1 = ""
TextBox1.SetFocus
End Sub

Private Sub UserForm_Initialize()
Application.EnableCancelKey = xlDisabled
SetWindowPos hWndForm, -1, 0&, 0&, 0&, 0&, 3 '讓視窗保持最上層
Call SetForegroundWindow(hWndForm) '讓視窗取得焦點

End Sub
Function hWndForm() As Long
hWndForm = FindWindow("ThunderDFrame", UserForm1.Caption) 'UserForm
End Function

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If Not TextBox1 = ID Then
ThisWorkbook.Saved = True
ThisWorkbook.Close
End If
SetWindowPos hWndForm, -2, 0&, 0&, 0&, 0&, 3
Application.EnableCancelKey = xlInterrupt
End Sub

用這個程序

❷ Excel2013載入宏報錯,提示存在編譯錯誤:UserForm1,求解答~~~

進宏編輯界面,在左邊的列表中的「窗體」中找到userform1,在其上右鍵→「查看代碼」,檢查代碼唄

閱讀全文

與vbauserform編譯錯誤相關的資料

熱點內容
資料庫查詢系統源碼 瀏覽:614
php5314 瀏覽:354
完美國際安裝到哪個文件夾 瀏覽:666
什麼app可以掃一掃做題 瀏覽:537
程序員編碼論壇 瀏覽:923
淘點是什麼app 瀏覽:656
中國高等植物pdf 瀏覽:451
51單片機時間 瀏覽:181
後台如何獲取伺服器ip 瀏覽:262
單片機流水燈程序c語言 瀏覽:232
程序員第二職業掙錢 瀏覽:237
運行里怎麼輸入伺服器路徑 瀏覽:837
pythonstepwise 瀏覽:506
劉一男詞彙速記指南pdf 瀏覽:61
php認證級別 瀏覽:364
方舟編譯啥時候推送 瀏覽:1009
php手機驗證碼生成 瀏覽:672
哲學思維pdf 瀏覽:14
凌達壓縮機有限公司招聘 瀏覽:531
weblogic命令部署 瀏覽:35