Private Sub 打开表格_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim myname As String
Dim x As Boolean, y As String
Dim i As Long
If IsNull(Me.人员ID.Value) = False And IsNull(DLookup("密码", "人员表", "人员ID=" & Me.人员ID.Value)) = False Then
x = Nz(Me.密码.Value, "") = DLookup("密码", "人员表", "人员ID=" & Me.人员ID.Value)
If x = True Then
Set xlApp = CreateObject("Excel.Application")
xlApp.Application.Visible = True
Set xlBook = xlApp.Workbooks.Open(CurrentProject.Path & "\LCD生产工令单.xls")
y = DLookup("权限", "人员表", "人员ID=" & Me.人员ID.Value)
If y = "全部" Then
For i = 1 To xlBook.Sheets.Count
xlBook.Sheets(i).Visible = True
Next
Else
myname = DLookup("部门表名", "部门表", "部门ID=" & Me.部门ID.Value)
xlBook.Sheets(myname).Visible = True
For i = 1 To xlBook.Sheets.Count
If xlBook.Sheets(i).Name <> myname Then
xlBook.Sheets(i).Visible = False
End If
Next
End If
Else
MsgBox "密码错误!"
End If
End If
Me.密码.Value = Null
Set xlboox = Nothing
Set xlApp = Nothing
End Sub作者: liwen 时间: 2009-7-29 15:00
如果只是需要进行权限设置,我想没必要在A和E中进行跳转.作者: yanwei82123300 时间: 2009-7-29 15:19
看看学学,再说作者: goto2008 时间: 2009-7-29 23:18
瞄瞄作者: asklove 时间: 2009-7-30 08:58
下载