以编程方式复制自定义快捷菜单栏(命令栏)? [英] Programmatically copy custom shortcut menu bars (command bars)?

查看:104
本文介绍了以编程方式复制自定义快捷菜单栏(命令栏)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我已经阅读了这个档案,并在网上搜索了一下

有用。


必须有一种方法可以将自定义菜单栏(或菜单栏,或命令

栏,或弹出命令栏等)从一个数据库移动到另一个数据库,

因为它是一个界面导入选项。我很高兴能够自己编码,但我需要一些指示。那里的任何人都做了这个或者找到了代码模板吗?看起来像CommandBar对象

属于Office库 - 如何将其附加到数据库

然后,仅使用代码?


以防万一:是的,我知道文件>获取外部数据>导入为

复制方法。我希望纯粹通过自动化和DAO来实现这一点,

因此不是一个选项。


任何帮助都将不胜感激。

Hi all,

I''ve read through the archives on this, and scoured the web, to little
avail.

There has to be a way to move custom menu bars (or menubars, or command
bars, or popup command bars, or whatever) from one database to another,
because it''s an interface import option. I''m happy to slog through
coding it myself, but I need a few pointers. Anyone out there done
this, or found code templates for it? Seems like the CommandBar object
belongs to the Office library--how do you attach that to a database
then, using code only?

Just in case: yes, I know about File > Get external data > Import as a
copying method. I wish to do this purely through automation and DAO,
so that''s not an option.

Any help would be greatly appreciated.

推荐答案

downwitch写道:
downwitch wrote:
大家好,

我'我已经阅读了这个档案,并浏览了网页,以获得一点点利用。

必须有一种方法来移动自定义菜单栏(或菜单栏,或命令
从一个数据库到另一个数据库的条形图或弹出命令栏等等,因为它是一个界面导入选项。我很高兴能够自己编写代码,但我需要一些指示。那里的任何人都做了这个,或者为它找到了代码模板?看起来像CommandBar对象
属于Office库 - 如何将其附加到数据库
然后,仅使用代码?

以防万一:是的,我知道关于文件>获取外部数据>导入为复制方法。我希望这纯粹是通过自动化和DAO来实现的,所以这不是一个选择。

任何帮助都将不胜感激。
Hi all,

I''ve read through the archives on this, and scoured the web, to little
avail.

There has to be a way to move custom menu bars (or menubars, or command
bars, or popup command bars, or whatever) from one database to another,
because it''s an interface import option. I''m happy to slog through
coding it myself, but I need a few pointers. Anyone out there done
this, or found code templates for it? Seems like the CommandBar object
belongs to the Office library--how do you attach that to a database
then, using code only?

Just in case: yes, I know about File > Get external data > Import as a
copying method. I wish to do this purely through automation and DAO,
so that''s not an option.

Any help would be greatly appreciated.



我很久以前通过导入表MSysCmdbars完成了这项工作。

当然带有代码的mdb在我的旧电脑上,这已经是

反汇编所以我没有它。我不记得我做了什么,因为

通常系统表是隐藏的,我能够取消隐藏表

然后导入或者我能够连接/链接到表并附加到

新数据库表,否则删除新数据库表并追加。

无论......它有效。我希望这能为你提供一个起点。


I did this a long time ago by importing the table MSysCmdbars. Of
course the mdb with the code is on my old computer which has been
disassemble so I don''t have it. I can''t remember what I did because
usually the system tables are hidden and I was able to unhide the table
then import or I was able to connect/link to the table and append to the
new database table or else delete the new database table and append in.
Whatever...it worked. I hope this gives you a starting point.


谢谢,但我认为MSysCmdbars在97之后就消失了。无论如何,

它是'即使系统表可见,也不再可见。

Thanks, but I think MSysCmdbars disappeared after 97. In any case,
it''s no longer visible, even with system tables visible.


顶级夫妇是古老的,但可能在97年工作;底部

情侣不是那么古老,可能会在以后的版本中使用:

子测试()

GetMenus" C:\文件和设置\ Lyle Fairfield \ My

Documents\Access\\\
orthwind.mdb",_

" NorthwindCustomMenuBar"
结束Sub


Sub GetMenus(ByVal dbsName As String,ParamArray MenuNames())

Dim bConfirmActionQueries As Boolean

Dim vMenuName As变种

Dim rst记录集


On Error Resume Next


bConfirmActionQueries = GetOption(" Confirm Action Queries" ;)

如果bConfirmActionQueries然后SetOption确认动作查询,

错误


使用DBEngine(0)(0)


Err = 0

.TableDefs(" MSysCmdBars")。Name = .TableDefs(" MSysCmdBars")。Name

如果Err = 3265那么''表不存在

。执行SELECT * INTO MSysCmdBars _

& FROM MSysCmdBars IN''" &安培; dbsName& ''没有;

。执行CREATE INDEX TbIndex ON MSysCmdBars(TbName)WITH

PRIMARY;"

结束如果

On Error GoTo 0

如果UBound(MenuNames)= -1那么''没有元素

。执行INSERT INTO MSysCmdBars " _

& SELECT * FROM MSysCmdBars IN''" &安培; dbsName& "'';"

Else

每个vMenuName在MenuNames中

.Execute" INSERT INTO MSysCmdBars" _

& SELECT * FROM MSysCmdBars IN''" &安培; dbsName& ''' _

& WHERE TBName =''" &安培; vMenuName& "'';"

下一个vMenuName

结束如果


.TableDefs.Refresh

设置rst = .TableDefs(" MSysCmdBars")。OpenRecordset

rst

如果不是(.BOF = True和.EOF = True)那么

.MoveFirst

错误继续下一步



CommandBars.Add(!TBName)

.MoveNext

Loop Until .EOF

On Error GoTo 0

结束如果

结束

Set rst = Nothing

结束


如果bConfirmActionQueries然后SetOption确认动作查询,

True


结束子


子g()

随WizHook

.Key = 51488399

.WizCopyCmdbars" C:\Documents and Settings\Lyle Fairfield \ Myy />
Documents\Access\ESO\EsoAdmin.adp"

结束

结束子


子g1()

随WizHook

.Key = 51488399

.WizCopyCmdbars" C:\Documents and Settings \ Lyle Fairfield \ My

Documents\Access\\\
orthwind.mdb"

结束

结束子

The top couple are très ancient but might work in 97; the bottom
couple are not so très ancient and might work in later versions:
Sub test()
GetMenus "C:\Documents and Settings\Lyle Fairfield\My
Documents\Access\northwind.mdb", _
"NorthwindCustomMenuBar"
End Sub

Sub GetMenus(ByVal dbsName As String, ParamArray MenuNames())
Dim bConfirmActionQueries As Boolean
Dim vMenuName As Variant
Dim rst As Recordset

On Error Resume Next

bConfirmActionQueries = GetOption("Confirm Action Queries")
If bConfirmActionQueries Then SetOption "Confirm Action Queries",
False

With DBEngine(0)(0)

Err = 0
.TableDefs("MSysCmdBars").Name = .TableDefs("MSysCmdBars").Name
If Err = 3265 Then ''table doesn''t exist
.Execute "SELECT * INTO MSysCmdBars " _
& "FROM MSysCmdBars IN ''" & dbsName & "'' WHERE NO;"
.Execute "CREATE INDEX TbIndex ON MSysCmdBars (TbName) WITH
PRIMARY;"
End If
On Error GoTo 0
If UBound(MenuNames) = -1 Then ''no elements
.Execute "INSERT INTO MSysCmdBars " _
& "SELECT * FROM MSysCmdBars IN ''" & dbsName & "'';"
Else
For Each vMenuName In MenuNames
.Execute "INSERT INTO MSysCmdBars " _
& "SELECT * FROM MSysCmdBars IN ''" & dbsName & "'' " _
& "WHERE TBName = ''" & vMenuName & "'';"
Next vMenuName
End If

.TableDefs.Refresh
Set rst = .TableDefs("MSysCmdBars").OpenRecordset
With rst
If Not (.BOF = True And .EOF = True) Then
.MoveFirst
On Error Resume Next
Do
CommandBars.Add (!TBName)
.MoveNext
Loop Until .EOF
On Error GoTo 0
End If
End With
Set rst = Nothing
End With

If bConfirmActionQueries Then SetOption "Confirm Action Queries",
True

End Sub

Sub g()
With WizHook
.Key = 51488399
.WizCopyCmdbars "C:\Documents and Settings\Lyle Fairfield\My
Documents\Access\ESO\EsoAdmin.adp"
End With
End Sub

Sub g1()
With WizHook
.Key = 51488399
.WizCopyCmdbars "C:\Documents and Settings\Lyle Fairfield\My
Documents\Access\northwind.mdb"
End With
End Sub


这篇关于以编程方式复制自定义快捷菜单栏(命令栏)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆