Francesc,
Are you looking to create a permenant application tooblar on your own machine, or a custom toolbar that is part of your form template?
The link you originally posted indicates a form toolbar... the instructions Scott provides work, but create a machine dependent application toolbar that is not part of the form.
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
Hi,
Here are sample steps that I just completed that appear to work - let me
know if you do not get the same results:
- Create a new, blank InfoPath form
- From the Tools menu, choose Customize
- Select the Toolbars tab
- Click the New button and enter: TestCBar as the name
- Select the Commands tab
- Select the Insert Category
- Drag the Clip Art Command to TestCBar
- Click Close
- Add a button to the form
- Add the following code to the Click event of the button:
Dim objCommandBars
Dim objControl
Stop
Set objCommandBars = Application.ActiveWindow.CommandBars
Set objControl = objCommandBars("TestCBar").FindControl(1, 682)
XDocument.UI.Alert objControl.Caption
- Make your form fully trusted
- Test
When I test this code, I get a message box with the caption: Clip Art. If I
then add another button to the toolbar and modify the code to reflect that
controls "ID", I correctly get that caption as well.
Let me know if I am doing something different.
Thanks!
Scott L. Heim
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.