My Add-ins don work on word ???

M

Medes

Hi all,

I have three questions i hope you can help me.

1. why my add-ins dont work for ms word? i use same code with changes (app
...) and it works for excel. (actualy it works for ms word too but i dont know
what i have changed, now ms word dont answer to any add-ins).

2. how can i get custom perpeties for the active document, I want to add
text as new custom property for active document by clikcing on a button.

2. why my code does not insert text to active cell in excel. here is a litle
bit of code that should insert text to active cell it locate in Connect.cs

Excel.Application excelApp = null;

public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
excelApp = (Excel.Application)application;
insertText = MakeANewButton(toolBar, "Insert text", 1044, new
_CommandBarButtonEvents_ClickEventHandler(insertText_Click));
}

private CommandBarButton MakeANewButton(CommandBar commandBar, string
caption, int faceID, _CommandBarButtonEvents_ClickEventHandler 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";
}
}
 
B

Bernd Schend

Hi Medes,

as to 1:
My be there are some leftovers in the registry from a previuos
installation. Search the registry for these entries and delete them
manually.

as to 2:
Assign a new value to a custom property as follows:
ActiveDocument.CustomDocumentProperties("XYZ").Value = "Hi"
Note, if the property XYZ is not yet in the property collection, use:
ActiveDocument.CustomDocumentProperties.Add Name:="XYZ",
LinkToContent:=False,
Value:="Hi", _
Type:=msoPropertyTypeString

as to second "2.": don't know

Regards
Bernd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top