Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default How can I enum the all visible items on quick toolbar and Tabs

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default How can I enum the all visible items on quick toolbar and Tabs

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 , 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default How can I enum the all visible items on quick toolbar and Tabs

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:
[i]
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;
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 , 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default How can I enum the all visible items on quick toolbar and Tabs

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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default How can I enum the all visible items on quick toolbar and Tabs

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 , 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.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default How can I enum the all visible items on quick toolbar and Tabs

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
quick access toolbar Matt Swanson[_2_] Setting up and Configuration of Excel 0 March 3rd 10 04:38 PM
Quick Access Toolbar dbs Excel Discussion (Misc queries) 2 July 4th 08 04:02 PM
quick access toolbar azdbacks2005 Excel Discussion (Misc queries) 1 June 15th 07 07:51 PM
quick access toolbar Jan Excel Discussion (Misc queries) 3 March 22nd 07 11:35 AM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"