|
3#
楼主 |
发表于 2013-5-23 16:18:42
|
只看该作者
我传不上来,我把代码传上来请你看看,是以前一个老师的例子,我在ADP中总是不能调用,在access2010是好的,转成ADP就不行了!
1.模块:Ribbonloader
Sub loadRibbons()
Dim i As Integer
Dim db As DAO.Database
Set db = Application.CurrentDb
For i = 0 To (db.TableDefs.count - 1)
If (InStr(1, db.TableDefs(i).Name, "USysRibbons")) Then
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(db.TableDefs(i).Name)
rs.MoveFirst
While Not rs.EOF
On Error Resume Next
Application.LoadCustomUI rs("RibbonName").Value, rs("RibbonXml").Value
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
End If
Next i
db.Close
Set db = Nothing
End Sub
2.表:USysRibbons
lngID RibbonName RibbonXml
3 AppRibbon "<customUI xmlns=""http://schemas.microsoft.com/office/2006/01/customui"">
<ribbon startFromScratch=""true"">
<tabs>
<tab id=""dbCustomTab"" label=""信息中心"" visible=""true"">
<group id=""dbCustomGroup"" label=""自定义组"">
<control idMso=""Paste"" label=""内置粘贴"" enabled=""true""/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>"
3.窗体:mainform
Private Sub Form_Open(Cancel As Integer)
loadRibbons
End Sub
|
|