Print Page | Close Window

Call CustomizeOption window by code

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1158
Printed Date: 15 November 2024 at 5:14pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Call CustomizeOption window by code
Posted By: Bush
Subject: Call CustomizeOption window by code
Date Posted: 08 September 2004 at 4:17am
Somebody knows how to call the "CustomizeOption Window" by code?



Replies:
Posted By: Boyd
Date Posted: 08 September 2004 at 7:59am

There's no straightforward way to do this.  My workaround is to create a dummy popup menu and then add a control to that menu that has the same ID as the 'Customize' control that appears on the built-in customize menu.  You can then use the 'Execute' method of that control to trigger the 'Customize' dialog.  I just wrapped the routine up in a function so that I can easily call it for any of my CommandBars instances.  I've been using this approach without any problems whatsoever.  Here's some sample code:

Public Function CustomizeToolbar(ByRef cb as CommandBars)
    Dim TempBar As CommandBar, Control As CommandBarControl
    If cb Is Nothing Then Exit Sub
    Set TempBar = cb.Add("Temp", xtpBarPopup)
    Set Control = TempBar.Controls.Add(xtpControlButton, 35001, "Temporary")
    Control.Execute
End Function

Simply call this function and pass a reference to the CommandBars object you want to customize.  Enjoy!!



Posted By: Bush
Date Posted: 08 September 2004 at 8:29am

Thx a lot Boyd, I added .Add(xtpControlButton, 35001, "Adapt...") in the frmLoad and it works.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net