以下代码是针对内部表的用户,进行指定用户不可见或不可用的限制:
建立了一个授菜单权表.
For Each rt As RibbonMenu.Tab In RibbonTabs
rt.Visible = True
rt.Enabled = True
For Each rg As RibbonMenu.Group In rt.Groups
rg.Visible = True
rg.Enabled = True
For Each itm As RibbonMenu.RibbonItem In rg.Items
itm.Visible = True
itm.Enabled = True
Next
Next
Next
For Each dr As DataRow In DataTables("菜单权限表").Select("用户名 = '" & UserName & "'" )
If dr.IsNull("分组名") Then
RibbonTabs(dr("菜单名")).Visible = Not dr("不可见")
RibbonTabs(dr("菜单名")).Enabled = Not dr("不可用")
ElseIf dr.IsNull("按钮名") Then
RibbonTabs(dr("菜单名")).Groups(dr("分组名")).Visible = Not dr("不可见")
RibbonTabs(dr("菜单名")).Groups(dr("分组名")).Enabled = Not dr("不可用")
Else
RibbonTabs(dr("菜单名")).Groups(dr("分组名")).Items(dr("按钮名")).Visible = Not dr("不可见")
RibbonTabs(dr("菜单名")).Groups(dr("分组名")).Items(dr("按钮名")).Enabled = Not dr("不可用")
End If
Next
而我当前使用的是外部数据表(Access)的.请问,我应该如何修改以上代码,才能实现?
[此贴子已经被作者于2012-8-24 0:48:38编辑过]