代码写到登陆按钮的click事件即可。
If _UserGroup <> "总经办" Then
RibbonTabs("Table").Visible = False
RibbonTabs("Project").Visible = False
RibbonTabs("Other").Visible = False
RibbonTabs("Common").Visible = False
RibbonTabs("Print").Visible = False
Dim rcgz As DataRow
rcgz = DataTables("菜单权限").Find("部门 = '" & _UserGroup & "' And 栏目 = '日常工作'")
If rcgz("使用权限") = True Then
RibbonTabs("Common").Visible = True
End If
Dim sjb As DataRow
sjb = DataTables("菜单权限").Find("部门 = '" & _UserGroup & "' And 栏目 = '数据表'")
If sjb("使用权限") = True Then
RibbonTabs("Table").Visible = True
End If
Dim glxm As DataRow
glxm = DataTables("菜单权限").Find("部门 = '" & _UserGroup & "' And 栏目 = '管理项目'")
If glxm("使用权限") = True Then
RibbonTabs("Project").Visible = True
End If
Dim dysc As DataRow
dysc = DataTables("菜单权限").Find("部门 = '" & _UserGroup & "' And 栏目 = '打印输出'")
If dysc("使用权限") = True Then
RibbonTabs("Print").Visible = True
End If
Dim zx As DataRow
zx = DataTables("菜单权限").Find("部门 = '" & _UserGroup & "' And 栏目 = '杂项'")
If zx("使用权限") = True Then
RibbonTabs("Other").Visible = True
End If
End If