kourosh saleh

kourosh saleh

  • NA
  • 20
  • 51k

Shared Add-in problem

May 5 2006 2:39 AM
Hi, 

I have three question:

1. I had a shared Add-In project that worked good on ms word but i dont now 
what i have changed ms word dont answer any more to any add-in project, I tr
yed to debugg my code i set "start external program" to Word.exe and used br
eak points but i got message like 
"the breakpoint will not currently be hit no symbols have been loaded for th
is document". 

2. how can i insert a text as a custom property to word document?
3. i have made same add-in for Excel it works but i can not insert text to a
ctiveCell, I can see my toolbar and my button but it can not insert text.
here is a litle bit of my code:

Excel.Application excelApp = null;

public void OnConnection(object application, Extensibility.ext_ConnectMode c
onnectMode, object addInInst, ref System.Array custom)
{
  excelApp = (Excel.Application)application;
  insertText = MakeANewButton(toolBar, "Insert text", 1044, new _CommandBarB
 uttonEvents_ClickEventHandler(insertText
_Click));
}

private CommandBarButton MakeANewButton(CommandBar commandBar, string captio
n, int faceID,  _CommandBarButtonEvents_ClickEventHandle
r clickHandler)
  {
     object missing = System.Reflection.Missing.Value;
     try
     {
        Microsoft.Office.Core.CommandBarButton newButton;
        newButton = (CommandBarButton)commandBar.Controls.Add(MsoControlType
.msoControlButton, missing, missing, missing, missing);

         newButton.Caption = caption;
         newButton.FaceId = faceID;
         newButton.Click += clickHandler;
         return newButton;
      }
      catch 
      {
          return null;
      }
   }


public void insertText_Click(CommandBarButton barButton, ref bool someBool)
{
   if (excelApp != null)
   {
      this.excelApp.ActiveCell.Value2 = "someText";    
   }
}