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. 12 6713
downwitch wrote: 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.
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.
Thanks, but I think MSysCmdbars disappeared after 97. In any case,
it's no longer visible, even with system tables visible.
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
Well... That felt very exciting for a moment. I'd never heard of the
fancy WizHook, the undocumented tool! The gold mine, the magic key!
But no. The first bit of code founders because there's no MSysCmdBars
past 97. And according to the little bit of doc I found on the web,
2002 is the first version that supported the WizHook method.
I, naturally, am using 2000. So I get the dreaded Error 438 Object
doesn't support this property or method. So thanks Lyle, but no dice.
Did make me wonder, however, whether there might not be some shadow
documentation out there of the wizard mdes-- acwztool.mde,
acwzmain.mde, and acwzlib.mde--and whether command-bar stuff might live
in there.
Any other ideas?
Wizhook was definitely in AC2K. Peter Walker was the first to post
about it shortly after AC2K was shipped. I can verify that
(.WizCopyCmdBars) exists and works in Ac2002 and Ac2003. It seems then
that it's missing from AC2K; arrrrrrrgggggggghhhhhh.
****
If we are in hack land this is quite clumsy but TTBOMK one can create
CmdBars in AC97 then copy MSysCmdBars from the AC97 db to an AC>97 db.
Limited testing shows that the toolbars now work and can be transferred
to and from AC>97 dbs
(and updated) using the MSysCmdBars table. My guess is that MS removed
the table without removing the default use of the table. But this is on
the cusp of being ridiculous.
****
Life is grand.
"downwitch" <do*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... Any other ideas?
You could start with something like below.
- Steve
' Copy a command bar or toolbar to a new one
' Example: CommandBarCopy "Form View", "tbrFormViewNew"
Public Function CommandBarCopy(strCbrOrigName As String, strCbrNewName As
String) As Boolean
Dim cbrNew As CommandBar, ctl As CommandBarControl
On Error GoTo Problem
Set cbrNew = CommandBars.Add(strCbrNewName)
cbrNew.Visible = True
For Each ctl In CommandBars(strCbrOrigName).Controls
ctl.Copy cbrNew
Next ctl
Set ctl = Nothing
Set cbrNew = Nothing
Exit Function
Problem:
MsgBox Err.Description, vbCritical, "CommandBarCopy Error"
End Function
Wow, a 97 pass-through. I never would have thought of that! Nor, I
think, have I the patience.
But I agree, life *is* grand.
Lyle Fairfield wrote: Wizhook was definitely in AC2K. Peter Walker was the first to post about it shortly after AC2K was shipped. I can verify that (.WizCopyCmdBars) exists and works in Ac2002 and Ac2003. It seems then that it's missing from AC2K; arrrrrrrgggggggghhhhhh. **** If we are in hack land this is quite clumsy but TTBOMK one can create CmdBars in AC97 then copy MSysCmdBars from the AC97 db to an AC>97 db. Limited testing shows that the toolbars now work and can be transferred to and from AC>97 dbs (and updated) using the MSysCmdBars table. My guess is that MS removed the table without removing the default use of the table. But this is on the cusp of being ridiculous. **** Life is grand.
Thanks Steve, but that actually only copies a command bar within the
current application. I'm trying to move it from one to another, and
since CommandBar belongs to Office (as opposed to Application or some
useful between-db library), you can't automate it or anything.
Sky wrote: You could start with something like below. - Steve
' Copy a command bar or toolbar to a new one ' Example: CommandBarCopy "Form View", "tbrFormViewNew"
<snip>
Follow-up: how to copy "button image" from one commandbarcontrol to
another:
Sub uCommandBarCtl_CopyImage(pctlCbrSource As CommandBarControl, _
pctlCbrNew As CommandBarControl)
On Error Resume Next
'get commandbar button image (custom or built-in) and paste
pctlCbrSource.CopyFace
pctlCbrNew.PasteFace
End Sub
Thanks for the update and additional code sample.
--
Jeff Conrad
Access Junkie - MVP http://home.bendbroadband.com/conrad...essjunkie.html http://www.access.qbuilt.com/html/articles.html
"downwitch" wrote in message:
news:11*********************@z14g2000cwz.googlegro ups.com... Follow-up: how to copy "button image" from one commandbarcontrol to another:
Sub uCommandBarCtl_CopyImage(pctlCbrSource As CommandBarControl, _ pctlCbrNew As CommandBarControl) On Error Resume Next
'get commandbar button image (custom or built-in) and paste pctlCbrSource.CopyFace pctlCbrNew.PasteFace
End Sub
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lex |
last post by:
I am writing a C# app that has a Menu. Some of the menu items will
have short cuts that do not exist in the Shortcut enum. I would like
the custom shortcuts to appear on the menu but as far as I...
|
by: Larry R Harrison Jr |
last post by:
I have Access 97. I know how to create custom command bars. I typically
create pull-down menus; seldom do I create toolbars. But I have a case where
I would; in fact, I would like to have a menu...
|
by: Salad |
last post by:
A97. If you set a forms properties to ShortcutMenu = No, the entire
form is disabled from displaying a shortcut menu.
If you set the property to Yes, all controls have a shortcut menu.
I have...
|
by: Ian Hinson |
last post by:
I have an Access app that has been distributed with run-time installation to
many different customers over many years.
It is developed in Access 2000. The custom menu bar has had no problems in...
|
by: Wayne |
last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom
menu bar designer. Is it in the beta? Maybe I'm blind. The question
that comes to mind is: Will custom menu bars be the same...
| |
by: rdemyan via AccessMonster.com |
last post by:
I have custom menu bars for Admins and Users. I now need to add a new group
call 'DataEntry'. Their custom menu bar will be very similar to that for
Admins, with just a few items removed.
So, is...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |