導航:首頁 > 源碼編譯 > 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編譯錯誤相關的資料

熱點內容
什麼是金稅盤伺服器 瀏覽:434
phpsocket開發 瀏覽:507
caj文檔轉pdf 瀏覽:550
eclipsemaven命令配置 瀏覽:335
雅安視監控app叫什麼名字 瀏覽:729
東方財富app籌碼藍色和紅色是什麼 瀏覽:564
pr安裝文件夾圖標變白 瀏覽:177
如何用伺服器建設網站 瀏覽:347
定時鬧鍾單片機課程設計 瀏覽:537
腰椎壓縮性骨折症狀 瀏覽:466
絕地求生全軍出擊的伺服器什麼時候開 瀏覽:490
怎麼入侵游戲伺服器篡改數據 瀏覽:734
線性壓縮機原理 瀏覽:540
javanewinstance 瀏覽:815
程序員第一玄學 瀏覽:497
精品源碼怎麼算 瀏覽:491
加密技術在現實中應用體會 瀏覽:180
單片機如何換晶振 瀏覽:206
合並兩個數組java 瀏覽:13
命令標注圓半徑怎麼用 瀏覽:660