|
1、用户窗体“确定”按钮代码
Private Sub CommandButton1_Click()
Dim rg As Range
Set rg = ws.[c9]
If Text1.Text = "123456" Then
MsgBox "欢迎进入VBA数据库开发课堂", vbOKOnly + vbInformation, "提示"
rg = "你对知识的渴望正是我们生生不息的源动力"
rg.Font.Color = RGB(255, 0, 0)
rg.Font.Name = "宋体"
rg.Font.Bold = True
rg.Font.Size = 12
Unload Me
Else
MsgBox "你输入的密码错误,请重新输入", vbOKOnly + vbInformation, "错误提示"
Text1.Text = ""
Text1.SetFocus '获得焦点
End If
End Sub
2、用户窗体“取消”按钮代码
Private Sub CommandButton2_Click()
Unload Me
ActiveWorkbook.Close (False) '不显示保存对话框
End Sub
3、模块使用期限(syqx)代码
Sub drrj()
'不让屏幕刷新
Application.ScreenUpdating = False
Dim i As Integer
Dim x As Integer
Dim n As Integer
drsj.Visible = xlSheetVisible
'统计当前数据区域的总行数
i = drsj.[a1].CurrentRegion.Rows.Count
'如果错误就跳过
On Error Resume Next
If drsj.[a1] = "" Then
drsj.[a1] = Now
drsj.Visible = xlSheetVeryHidden
Exit Sub
End If
drsj.Cells(i + 1, 1).Value = Now
x = drsj.Cells(i + 1, 1).Value - drsj.Cells(i, 1).Value
n = drsj.Cells(i + 1, 1).Value - drsj.Cells(1, 1).Value
drsj.Visible = xlSheetVeryHidden
If n > 60 Or x < -1 Then
MsgBox "你的试用期已过,请与管理员联系"
<FONT face="Times New Ro |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|