PC Review


Reply
Thread Tools Rate Thread

How can I enum the all visible items on quick toolbar and Tabs

 
 
=?Utf-8?B?SmFzb24=?=
Guest
Posts: n/a
 
      16th Oct 2007
Hi all.

Q1: Enum all items on quick access toolbar.
My way:
int n = this.Application.CommandBars.Count;
for( int i = 1 ; i < n ; i++ )
{
if( this.Application.CommandBars[i].visible == true )
str = this.Application.CommandBars[i].Name;
}

My question is:
The name I got is like "WordArt","Picture",etc.
But I just want to know whether the item is "Undo" , "fileopen","filesave"?
How can I fix it?

Q2 Can I get the visible Tabs?
Can I get the visible Tabs' name etc?


Thanks a lot.
 
Reply With Quote
 
 
 
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      16th Oct 2007
Hello,

For your first question, your code is enumerating the visible command bars
in Word, such as WordArt command bar, Picture command bar, etc. What you
said "Undo", "fileopen", "filesave" actually means the buttons in a certain
command bar. We could enumerate the Controls of a CommandBar object to get
all the buttons like "Undo", "fileopen", etc. Please refer to the following
code:
int n = application.CommandBars.Count;
for (int i = 1; i < n; i++)
{
CommandBar commandBar = application.CommandBars[i];
if (commandBar.Visible == true)
{
Console.WriteLine(commandBar.Name);

foreach (CommandBarControl control in
commandBar.Controls)
{
Console.WriteLine(" " + control.Caption);
}
}
}

For your second question about the tabs in Word. Would you let me know
which control do you mean by "Tab" in Word? Are you using Word 2003 or Word
2007? I am looking forward to your reply.

Sincerely,
Jialiang Ge ((E-Mail Removed), remove ¡®online.¡¯)
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box ¡°Tools/Options/Read: Get 300 headers at a time¡±
to see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided ¡°AS IS¡± with no warranties, and confers no
rights.

 
Reply With Quote
 
=?Utf-8?B?SmFzb24=?=
Guest
Posts: n/a
 
      16th Oct 2007
Thanks for your reply.
>>Q1:

Now I know what the commandbars[i] is specified for.
But I tryed to get the buttons on the quick access toolbar, but i don't
know which object I should use. I used Application.toolbar, but it don't get
the right one.

>>Q2

I use 2007, so the tab means tab in ribbon like "home" "view"....

Thanks

"Jialiang Ge [MSFT]" wrote:

> Hello,
>
> For your first question, your code is enumerating the visible command bars
> in Word, such as WordArt command bar, Picture command bar, etc. What you
> said "Undo", "fileopen", "filesave" actually means the buttons in a certain
> command bar. We could enumerate the Controls of a CommandBar object to get
> all the buttons like "Undo", "fileopen", etc. Please refer to the following
> code:
> int n = application.CommandBars.Count;
> for (int i = 1; i < n; i++)
> {
> CommandBar commandBar = application.CommandBars[i];
> if (commandBar.Visible == true)
> {
> Console.WriteLine(commandBar.Name);
>
> foreach (CommandBarControl control in
> commandBar.Controls)
> {
> Console.WriteLine(" " + control.Caption);
> }
> }
> }
>
> For your second question about the tabs in Word. Would you let me know
> which control do you mean by "Tab" in Word? Are you using Word 2003 or Word
> 2007? I am looking forward to your reply.
>
> Sincerely,
> Jialiang Ge ((E-Mail Removed), remove ¡®online.¡¯)
> Microsoft Online Community Support
>
> ==================================================
> For MSDN subscribers whose posts are left unanswered, please check this
> document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications. If you are using Outlook Express/Windows Mail, please make sure
> you clear the check box ¡°Tools/Options/Read: Get 300 headers at a time¡±
> to see your reply promptly.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
> This posting is provided ¡°AS IS¡± with no warranties, and confers no
> rights.
>
>

 
Reply With Quote
 
=?Utf-8?B?SmFzb24=?=
Guest
Posts: n/a
 
      16th Oct 2007
And I also try to use commandbars["Standard"], it seems fail.
I set Application.CommandBars["Standard"].visible = false in start_up.
("Stardard" or not , I don't know, I just have a try)
It does not effective at all.


Why.

Thanks
 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      16th Oct 2007
Hello,

Word 2007 does not provide object model for Ribbon tab and Quick Access
Toolbar. To access them, we need to utilize the Office Open XML Format file
created by one of the Microsoft Office applications that support the Office
Fluent UI. Please refer to the following two MSDN articles for detailed
information.

Customizing the Quick Access Toolbar in the 2007 Office Fluent User
Interface
http://msdn2.microsoft.com/en-us/library/bb687747.aspx

Programmatically Customizing the 2007 Office Fluent User Interface
http://msdn2.microsoft.com/en-us/library/bb335359.aspx

You also mentioned that it throws an exception when you try to set Visible
attribute of a command bar object. This is an known issue of Microsoft
Office products because part of Office command bar does not support being
hidden. Please have a look at the KB article:
http://support.microsoft.com/kb/291068/EN-US/
It provides a workaround:
Sub Command_Bars()
On Error Resume Next
For Each ComBar In Application.CommandBars
ComBar.Visible = False
MsgBox ComBar.Name
Next ComBar
End Sub

That is to say, for those command bars that cannot be hidden, we try to
catch and skip the exception. If you are using C#, rather than VB.NET, we
could write:
try
{
ComBar.Visible = False
}
catch (Exception ex)
{ // do nothing here
}
Another possible workaround is to use Enable attribute of command bar
instead of Visible. Please have a try. Thanks

Sincerely,
Jialiang Ge ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
=?Utf-8?B?SmFzb24=?=
Guest
Posts: n/a
 
      16th Oct 2007
Thanks for your reply.

I have read that two articles before. And I also did a test of XML.
But in that way, every controls refers to item's id( idmso). I just want to
find a way that I can control them by name or caption. But it seems like I
can not do it.

I still have 2 question to ask,
Q1: Excel2007 PPT2007 is same to word2007, and must use xml to hide qat or
tab?

Q2:Both these 2 articles are not metioned VSTO. It just say add-in.
That means the project is not created by VSTO?

Thanks.
 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      17th Oct 2007
Hello

>I have read that two articles before. And I also did a test of
>XML. But in that way, every controls refers to item's id( idmso).
> I just want to find a way that I can control them by name or
>caption. But it seems like I can not do it.

For custom tab, we could get the tab's caption in the attribute: Label. For
buit-in tabs, the tabs' captions depend on the language setting of Office
system. They varies in different language of Office. Therefore, it is
recommended that we use their id (idmso) instead of the caption.

>I still have 2 question to ask,
>Q1: Excel2007 PPT2007 is same to word2007, and must use xml
>to hide qat or tab?

Yes. According to the 'Applies to:' section of the two articles, they apply
to the whole 2007 Microsoft Office system.

>Q2:Both these 2 articles are not metioned VSTO. It just say
>add-in. That means the project is not created by VSTO?

Yes, the test projects in the two articles are not for VSTO. If you are
using VSTO, please refer to the articles:

Walkthrough: Automating an Application from Controls on the Ribbon
http://msdn2.microsoft.com/en-us/library/aa942955(vs.80).aspx

Ribbon Extensibility Overview
http://msdn2.microsoft.com/en-us/library/aa942866(vs.80).aspx

How to: Customize the Ribbon
http://msdn2.microsoft.com/en-us/library/aa942954(vs.80).aspx

Visual Studio 2005 Tools for Office Second Edition
http://msdn2.microsoft.com/en-us/office/aa905543.aspx

If you have any other concern or need anything else, please feel free to
let me know.

Sincerely,
Jialiang Ge ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
=?Utf-8?B?SmFzb24=?=
Guest
Posts: n/a
 
      18th Oct 2007
Thanks for your reply.

Now I understand the all above.
But I still have a question.
All article above don't methioned ribbon in access2007.

I have heard that access2007 can't custominze ribbon bu the same way of
Excel... right?
Some article said we can customize access only by change a system table in
access2007, right?

Beside this way, no way?

Can I use the add-in way fellow this:
http://msdn2.microsoft.com/en-us/library/aa902693.aspx

Thanks
 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      19th Oct 2007
Hello,

As you said, Ribbon in Access 2007 can be customized, but not in the same
way as in Word 2007, Excel 2007, etc. In the MSDN article
http://msdn2.microsoft.com/en-us/library/aa338202.aspx, it says:

Applications that support the Ribbon (except Access 2007, as described
later in this article) provide two ways to customize the Fluent UI by using
XML markup: by using Office Open XML Formats files that contain XML markup,
or by using COM add-ins that contain XML markup. (In the case of Outlook,
only COM add-ins can customize the Fluent UI.) Any changes that you specify
in this XML markup add incrementally to the existing Fluent UI. For
example, providing XML markup that identifies a custom tab adds a single
tab to the existing tabs in the host application.

To customize the Ribbon in Access 2007, please refer to the section:
"Creating an Access Application-Level Custom Ribbon"
(http://msdn2.microsoft.com/en-us/lib...CustomizingRib
bonUIforDevelopers_AppLevel). Access 2007 does not expose other methods
except this one.

If you have any other concern or need anything else, please feel free to
let me know.

Sincerely,
Jialiang Ge ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Jialiang Ge [MSFT]
Guest
Posts: n/a
 
      23rd Oct 2007
Hi Jason,

If you need further assistance, feel free to let me know. I will be more
than happy to be of assistance.

Have a great day!

Sincerely,
Jialiang Ge ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Items Disbaled in Quick Access Toolbar JamesJ Microsoft Access Forms 0 7th Jul 2009 02:04 PM
Enum not visible in COM tshad Microsoft C# .NET 2 16th Feb 2009 08:48 PM
How to lock Excel 2007 quick access toolbar to be always visible? Sults Microsoft Excel Discussion 2 11th Nov 2008 04:47 PM
Tabs visible, not visible on form load Ryis Microsoft Access Forms 2 31st Oct 2008 06:57 PM
Change number of items displayed on Quick Launch Toolbar Lonpuz Windows XP Customization 2 29th Jan 2008 10:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:06 PM.