The Artima Developer Community
Sponsored Link

C# Answers Forum
Creating Word toolbar problem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
G

Posts: 1
Nickname: jojje
Registered: Apr, 2003

Creating Word toolbar problem Posted: Apr 8, 2003 1:39 AM
Reply to this message Reply
Advertisement
Hello, I'm trying to create an add-in to Word in forms of a toolbar. I am using an example from MSDN but I get an error message "Word.Application does not contain a definition for CommandBars".

Here is the function that is called and causes the error:

private Microsoft.Office.Core.CommandBar AddWordToolbar(
Word.Application word, string toolbarName)
{
Microsoft.Office.Core.CommandBar toolBar = null;
try
{
// Create a command bar for the add-in
object missing = System.Reflection.Missing.Value;
toolBar = (Microsoft.Office.Core.CommandBar)
word.CommandBars.Add(toolbarName, //<- Here is the probl
Microsoft.Office.Core.MsoBarPosition.msoBarTop,
missing, true );
toolBar.Visible = true;
return toolBar;
}

catch
{
return null;
}
}

Call of the method from the OnConnection method:

Microsoft.Office.Core.CommandBar toolBar = null;
toolBar = AddWordToolbar(wordApp, "RM toolbar.");

I have included Word Object library 10 as a reference. Have found the example at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTipsTricksBuildingMicrosoftOfficeAdd-insWithVisualCNETVisualBasicNET.asp

Does anyone have any idea what may cause this?

Topic: C++ mfc programming Previous Topic   Next Topic Topic: Problem with assembly for a sample app

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use