导航:首页 > 源码编译 > 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编译错误相关的资料

热点内容
命令与征服3泰伯利亚战争升级 浏览:690
投标工具需要加密锁吗 浏览:503
苏州阿里云服务器服务电话 浏览:783
怎么知道app专属流量 浏览:62
单片机模拟动画教程 浏览:735
linux解压镜像 浏览:164
c语言可以在哪编译 浏览:127
如何对spl的密码加密 浏览:73
oppoa59s如何添加应用加密 浏览:514
比特币asic算法 浏览:175
查看服务器外网访问地址 浏览:856
魔兽争霸地图最新加密 浏览:685
畅捷云APP怎么l发票 浏览:211
黑马程序员与传智播客 浏览:519
geany不能编译中文吗 浏览:523
和平精英怎么开启新服务器 浏览:541
单片机的典型应用 浏览:378
vivo手机怎么对qq进行加密 浏览:612
gcc编译器的链接脚本 浏览:578
服务器p01是什么 浏览:911