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

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/lib...55(vs.80).aspx

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

How to: Customize the Ribbon
http://msdn2.microsoft.com/en-us/lib...54(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 , 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.


  #8   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.

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
  #9   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,

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

  #10   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

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 , 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
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 05:50 AM.

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

About Us

"It's about Microsoft Excel"