|
各位大虾!我有一份表格,内有八张部门表格,需要对各个部门进行权限分配,就是查看和修改权限,还需要共享同时输入数据,excle+宏似乎解决不了,有高人提醒说用acess+excle可以搞定,请教各位大虾,具体如何操作?在 ...
yysky 发表于 2009-7-29 09:13
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 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|