View Full Version : 关于通过代码在word中增加toolbar的问题


VSTO 中 Office 模版的问题
03-29-2007, 03:12 AM
在vsto中为什么能够通过代码在word中重复增加相同名字的toolbarbutton,而在excel中则不行。是不是控制word的代码有bug阿,下面的代码在第二次运行时有该报错,但是没有,为什么?
private void thisdocument_starup(object sender,eventargs e)
{
Office.CommandBarButton newCBarButton = null;
Office.CommandBar newCommandBar = Application.CommandBars.
Add("myButton", Office.MsoBarPosition.msoBarTop,false, false);
newCBarButton = (Office.CommandBarButton)newCommandBar.Controls.
Add(Office.MsoControlType.msoControlButton, missing,
missing, missing, false);
newCBarButton.Caption = "my new button";
newCBarButton.FaceId = 563;
newCBarButton.Visible = true;
}

v-jicwan@prcvap.microsoft.com
03-30-2007, 06:23 AM
ã

ӭMSDNύ⣬ǽᾡ

VSTOжһCommandBarǷڣԲο룺
Dim cbar As Office.CommandBar
Dim bExists As Boolean
bExists = False
For Each cbar In Application.CommandBars
If cbar.Name = "Custom Toolbar" Then bExists = True
Next
If Not bExists Then
Set cbar = Application.CommandBars.Add("Custom Toolbar", _
msoBarFloating, False, True)
cbar.Visible = True
End If

ڴOffice Menus and Toolbars,Բοƪ£http://www.romanpress.com/Articles/Menus_R/Menus.htm

ΪʲôWordпͬCommandBar,ExcelвУϣܷһ򵥵IJԳMSDN飬Ǻԡ

Jasson Wang
߼ֹ֧ʦ
΢ȫ֧
---------------------------------------------------------------------------------------
ǵķʱ䣺һ9:00-18:00ڼճ⣩ǽգ48СʱṩʼӦһо⡣΢鼼֧Ϣʣhttp://support.microsoft.com/gp/newsgroupsupport/zh-cn.

ʱĶʹáظ(Reply to Group)⽫ûл档
---------------------------------------------------------------------------------------
ԡ״ṩûκεͬʱҲûκȨ

VSTO 中 Office 模版的问题
04-02-2007, 03:12 AM
请问怎么上传测试程序到msdn新闻组?

v-jicwan@prcvap.microsoft.com
04-02-2007, 03:39 AM
ã

԰ʼķʽϴIJԳMSDNֱӽIJԳ򷢵ҵ䣺v-jicwan@microsoft.com.ǽᾡ⡣

Jasson Wang
߼ֹ֧ʦ
΢ȫ֧
---------------------------------------------------------------------------------------
ǵķʱ䣺һ9:00-18:00ڼճ⣩ǽգ48СʱṩʼӦһо⡣΢鼼֧Ϣʣhttp://support.microsoft.com/gp/newsgroupsupport/zh-cn.

ʱĶʹáظ(Reply to Group)⽫ûл档
---------------------------------------------------------------------------------------
ԡ״ṩûκεͬʱҲûκȨ

v-jicwan@prcvap.microsoft.com
04-05-2007, 11:04 AM
:

Ҳij,VSTOпظWordͬToolbarButtonҳ򲻻׳κ쳣VSTOһbug,ͨӽܵbug΢Ʒ飺http://connect.microsoft.com/site/sitehome.aspx?SiteID=210

Jasson Wang
߼ֹ֧ʦ
΢ȫ֧
---------------------------------------------------------------------------------------
ǵķʱ䣺һ9:00-18:00ڼճ⣩ǽգ48СʱṩʼӦһо⡣΢鼼֧Ϣʣhttp://support.microsoft.com/gp/newsgroupsupport/zh-cn.

ʱĶʹáظ(Reply to Group)⽫ûл档
---------------------------------------------------------------------------------------
ԡ״ṩûκεͬʱҲûκȨ