Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 24 Oct 2005 19:02:21 +0200,    group: microsoft.public.word.vba.addins        back       


Exception when adding a toolbar as a word-addin   
Hi all,

I tried to build a MSDN-Tip how to integrates a word-toolbar in a
addin:
(http://support.microsoft.com/Default.aspx?kbid=302901#XSLTH3228121124120121120120)

The class member applicationObject was initialized with the
word-application-objekt. When calling


Microsoft.Office.Core.Commandbar toolbar = null;
try
{
toolbar = (Microsoft.Office.Core.CommandBar)_
applicationObject.CommandBars.Add("My Toolbar",_
Microsoft.Office.Core.MsoBarPosition.msoBarFloating,_
System.Reflection.Missing.Value, true);
}
catch (Exception ee)
{
......
}


I recieve the exception:
"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
which means pretty much:
"The bject link was not assigned with a object instance."

How comes? I'm desparate...
THX for all the help, yours Langi
date: Mon, 24 Oct 2005 19:02:21 +0200   author:   Matthias Langbein

Re: Exception when adding a toolbar as a word-addin   
"Matthias Langbein"  wrote in message
news:qc4ql1lfjp06ia2rhjiga752kqd4m091jl@4ax.com
> Hi all,
>
> I tried to build a MSDN-Tip how to integrates a word-toolbar in a
> addin:
>
(http://support.microsoft.com/Default.aspx?kbid=302901#XSLTH3228121124120121
120120)
>
> The class member applicationObject was initialized with the
> word-application-objekt. When calling
>
>
> Microsoft.Office.Core.Commandbar toolbar = null;
> try
> {
> toolbar = (Microsoft.Office.Core.CommandBar)_
> applicationObject.CommandBars.Add("My Toolbar",_
> Microsoft.Office.Core.MsoBarPosition.msoBarFloating,_
> System.Reflection.Missing.Value, true);
> }
> catch (Exception ee)
> {
> .....
> }
>
>
> I recieve the exception:
> "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
> which means pretty much:
> "The bject link was not assigned with a object instance."
>
> How comes? I'm desparate...
> THX for all the help, yours Langi

You are writing an add-in using C# and posted the question to a COM group
and 2 VB groups?

Try searching for newsgroups containing .dotnet. in the name.

-- 
Reply to the group so all can participate
VB.Net: "Fool me once..."
date: Mon, 24 Oct 2005 10:09:10 -0700   author:   Bob Butler

On his behalf, writing an office plug in with C# is creating a COM addin...   
On his behalf, writing an office plug in with C# is creating a COM addin...

"Bob Butler"  wrote in message 
news:uDZzp2L2FHA.664@tk2msftngp13.phx.gbl...
> "Matthias Langbein"  wrote in message
> news:qc4ql1lfjp06ia2rhjiga752kqd4m091jl@4ax.com
>> Hi all,
>>
>> I tried to build a MSDN-Tip how to integrates a word-toolbar in a
>> addin:
>>
> (http://support.microsoft.com/Default.aspx?kbid=302901#XSLTH3228121124120121
> 120120)
>>
>> The class member applicationObject was initialized with the
>> word-application-objekt. When calling
>>
>>
>> Microsoft.Office.Core.Commandbar toolbar = null;
>> try
>> {
>> toolbar = (Microsoft.Office.Core.CommandBar)_
>> applicationObject.CommandBars.Add("My Toolbar",_
>> Microsoft.Office.Core.MsoBarPosition.msoBarFloating,_
>> System.Reflection.Missing.Value, true);
>> }
>> catch (Exception ee)
>> {
>> .....
>> }
>>
>>
>> I recieve the exception:
>> "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
>> which means pretty much:
>> "The bject link was not assigned with a object instance."
>>
>> How comes? I'm desparate...
>> THX for all the help, yours Langi
>
> You are writing an add-in using C# and posted the question to a COM group
> and 2 VB groups?
>
> Try searching for newsgroups containing .dotnet. in the name.
>
> -- 
> Reply to the group so all can participate
> VB.Net: "Fool me once..."
>
date: Mon, 24 Oct 2005 13:29:27 -0400   author:   Jamie Ayer

Re: Exception when adding a toolbar as a word-addin   
Sorry!!! I clicked reply on a formerly stored message to find a
apropriate group, but forgot to check the other groups in the header.
My mistake, sorry again...

On Mon, 24 Oct 2005 10:09:10 -0700, "Bob Butler"
 wrote:

>"Matthias Langbein"  wrote in message
>news:qc4ql1lfjp06ia2rhjiga752kqd4m091jl@4ax.com
>> Hi all,
>>
>> I tried to build a MSDN-Tip how to integrates a word-toolbar in a
>> addin:
>>
>(http://support.microsoft.com/Default.aspx?kbid=302901#XSLTH3228121124120121
>120120)
>>
>> The class member applicationObject was initialized with the
>> word-application-objekt. When calling
>>
>>
>> Microsoft.Office.Core.Commandbar toolbar = null;
>> try
>> {
>> toolbar = (Microsoft.Office.Core.CommandBar)_
>> applicationObject.CommandBars.Add("My Toolbar",_
>> Microsoft.Office.Core.MsoBarPosition.msoBarFloating,_
>> System.Reflection.Missing.Value, true);
>> }
>> catch (Exception ee)
>> {
>> .....
>> }
>>
>>
>> I recieve the exception:
>> "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
>> which means pretty much:
>> "The bject link was not assigned with a object instance."
>>
>> How comes? I'm desparate...
>> THX for all the help, yours Langi
>
>You are writing an add-in using C# and posted the question to a COM group
>and 2 VB groups?
>
>Try searching for newsgroups containing .dotnet. in the name.
date: Mon, 24 Oct 2005 20:11:21 +0200   author:   Matthias Langbein

Re: Exception when adding a toolbar as a word-addin   
Bob Butler  wrote:
> "Matthias Langbein"  wrote in message
> news:qc4ql1lfjp06ia2rhjiga752kqd4m091jl@4ax.com
>> I tried to build a MSDN-Tip how to integrates a word-toolbar in a addin:
>> 
> (http://support.microsoft.com/Default.aspx?kbid=302901#XSLTH3228121124120121120120)
>> 
>> The class member applicationObject was initialized with the word-application-objekt. When calling
>> 
>> Microsoft.Office.Core.Commandbar toolbar = null;
>> try
>> {
>> toolbar = (Microsoft.Office.Core.CommandBar)_
>> applicationObject.CommandBars.Add("My Toolbar",_
>> Microsoft.Office.Core.MsoBarPosition.msoBarFloating,_
>> System.Reflection.Missing.Value, true);
>> }
>> catch (Exception ee)
>> {
>> .....
>> }
>> 
>> 
>> I recieve the exception:
>> "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."
>> which means pretty much:
>> "The bject link was not assigned with a object instance."
>> 
> You are writing an add-in using C# and posted the question to a COM group and 2 VB groups?
> 
> Try searching for newsgroups containing .dotnet. in the name.

microsoft.public.office.developer.com.add_ins is the correct group.
Followup-To set accordingly.
date: Mon, 24 Oct 2005 14:54:26 -0400   author:   Alex am

Re: On his behalf, writing an office plug in with C# is creating a COM addin...   
"Jamie Ayer"  wrote in message
news:e9QhLAM2FHA.4032@TK2MSFTNGP15.phx.gbl
> On his behalf, writing an office plug in with C# is creating a COM
> addin...

I considered that but any issues are still more likely to be C#/dotnet
related than direclty COM related.  BTW, changing the subject is not usually
a good idea because it causes some newsreaders to see it as a new thread.

-- 
Reply to the group so all can participate
VB.Net: "Fool me once..."
date: Mon, 24 Oct 2005 12:16:57 -0700   author:   Bob Butler

Re: Exception when adding a toolbar as a word-addin   
Hi all,
I decided to post the code, maybe someone can tell me why there is the
exception...





namespace MyOwnAddIn
{
  using System;
  using Microsoft.Office.Core;
  using Extensibility;
  using System.Runtime.InteropServices;
  using Word = Microsoft.Office.Interop.Word;
	
[GuidAttribute("715D48EE-9F94-4055-AC62-4D22E89913AD"),
	ProgId("MyOwnAddIn.Connect")]

  public class Connect : Object, Extensibility.IDTExtensibility2
  {
    public Connect()
    {
    }

  public void OnConnection(object application,
	Extensibility.ext_ConnectMode connectMode, object addInInst,
	ref System.Array custom)
    {
    applicationObject = application;
    addInInstance = addInInst;
    if (application is Word.Application)
    { wordApp = (Word.Application)application; }
    Microsoft.Office.Core.CommandBar toolBar = null;
    if (wordApp != null)
    { toolBar = AddWordToolbar(wordApp, "Some useful toolbar."); }
    }

  public void OnDisconnection(Extensibility.ext_DisconnectMode
	disconnectMode, ref System.Array custom)
  {
  }

  public void OnAddInsUpdate(ref System.Array custom)
  {
  }

  public void OnStartupComplete(ref System.Array custom)
  {
  }

  public void OnBeginShutdown(ref System.Array custom)
  {
  }
		
  private Microsoft.Office.Core.CommandBar
	AddWordToolbar(Word.Application word, string toolbarName) 
  {
    Microsoft.Office.Core.CommandBar toolBar = null;
    try 
    {
      object missing = System.Reflection.Missing.Value;
      toolBar = (Microsoft.Office.Core.CommandBar)
      wordApp.CommandBars.Add(toolbarName,
	Microsoft.Office.Core.MsoBarPosition.msoBarTop, 
	missing, true );
      toolBar.Visible = true;
      return toolBar;
    }
    catch (Exception ee)
    {
      System.Windows.Forms.MessageBox.Show(ee.Message);
      return null;
    }
  }

  private object applicationObject;
  private object addInInstance;
  private Word.Application wordApp = null;
}
}
date: Tue, 25 Oct 2005 22:12:15 +0200   author:   Matthias Langbein

Re: Exception when adding a toolbar as a word-addin   
I get the warning:

 'Microsoft.Office.Core.CommandBar' is defined in multiple places;
using definition from
'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\office.dll'

Might this have anything to do with it? And how do I solve this
problem?


On Tue, 25 Oct 2005 22:12:15 +0200, Matthias Langbein
 wrote:

>Hi all,
>I decided to post the code, maybe someone can tell me why there is the
>exception...
>
>
>
>
>
>namespace MyOwnAddIn
>{
>  using System;
>  using Microsoft.Office.Core;
>  using Extensibility;
>  using System.Runtime.InteropServices;
>  using Word = Microsoft.Office.Interop.Word;
>	
>[GuidAttribute("715D48EE-9F94-4055-AC62-4D22E89913AD"),
>	ProgId("MyOwnAddIn.Connect")]
>
>  public class Connect : Object, Extensibility.IDTExtensibility2
>  {
>    public Connect()
>    {
>    }
>
>  public void OnConnection(object application,
>	Extensibility.ext_ConnectMode connectMode, object addInInst,
>	ref System.Array custom)
>    {
>    applicationObject = application;
>    addInInstance = addInInst;
>    if (application is Word.Application)
>    { wordApp = (Word.Application)application; }
>    Microsoft.Office.Core.CommandBar toolBar = null;
>    if (wordApp != null)
>    { toolBar = AddWordToolbar(wordApp, "Some useful toolbar."); }
>    }
>
>  public void OnDisconnection(Extensibility.ext_DisconnectMode
>	disconnectMode, ref System.Array custom)
>  {
>  }
>
>  public void OnAddInsUpdate(ref System.Array custom)
>  {
>  }
>
>  public void OnStartupComplete(ref System.Array custom)
>  {
>  }
>
>  public void OnBeginShutdown(ref System.Array custom)
>  {
>  }
>		
>  private Microsoft.Office.Core.CommandBar
>	AddWordToolbar(Word.Application word, string toolbarName) 
>  {
>    Microsoft.Office.Core.CommandBar toolBar = null;
>    try 
>    {
>      object missing = System.Reflection.Missing.Value;
>      toolBar = (Microsoft.Office.Core.CommandBar)
>      wordApp.CommandBars.Add(toolbarName,
>	Microsoft.Office.Core.MsoBarPosition.msoBarTop, 
>	missing, true );
>      toolBar.Visible = true;
>      return toolBar;
>    }
>    catch (Exception ee)
>    {
>      System.Windows.Forms.MessageBox.Show(ee.Message);
>      return null;
>    }
>  }
>
>  private object applicationObject;
>  private object addInInstance;
>  private Word.Application wordApp = null;
>}
>}
date: Wed, 26 Oct 2005 02:56:26 +0200   author:   Matthias Langbein

Re: Exception when adding a toolbar as a word-addin   
Yes, it has something to do with that error message.

I had the same problem. The resolution was to correct my reference to point 
to the office.dll in the GAC and make sure I didn't have references to any 
other versions of the office.dll

HTH

-- 
- B@rney
___________________________
http://www.sharepointdemo.biz/
http://www.sharepointdemo.biz/blogs/bjarne/


"Matthias Langbein" wrote:

> I get the warning:
> 
>  'Microsoft.Office.Core.CommandBar' is defined in multiple places;
> using definition from
> 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\office.dll'
> 
> Might this have anything to do with it? And how do I solve this
> problem?
> 
> 
> On Tue, 25 Oct 2005 22:12:15 +0200, Matthias Langbein
>  wrote:
> 
> >Hi all,
> >I decided to post the code, maybe someone can tell me why there is the
> >exception...
> >
> >
> >
> >
> >
> >namespace MyOwnAddIn
> >{
> >  using System;
> >  using Microsoft.Office.Core;
> >  using Extensibility;
> >  using System.Runtime.InteropServices;
> >  using Word = Microsoft.Office.Interop.Word;
> >	
> >[GuidAttribute("715D48EE-9F94-4055-AC62-4D22E89913AD"),
> >	ProgId("MyOwnAddIn.Connect")]
> >
> >  public class Connect : Object, Extensibility.IDTExtensibility2
> >  {
> >    public Connect()
> >    {
> >    }
> >
> >  public void OnConnection(object application,
> >	Extensibility.ext_ConnectMode connectMode, object addInInst,
> >	ref System.Array custom)
> >    {
> >    applicationObject = application;
> >    addInInstance = addInInst;
> >    if (application is Word.Application)
> >    { wordApp = (Word.Application)application; }
> >    Microsoft.Office.Core.CommandBar toolBar = null;
> >    if (wordApp != null)
> >    { toolBar = AddWordToolbar(wordApp, "Some useful toolbar."); }
> >    }
> >
> >  public void OnDisconnection(Extensibility.ext_DisconnectMode
> >	disconnectMode, ref System.Array custom)
> >  {
> >  }
> >
> >  public void OnAddInsUpdate(ref System.Array custom)
> >  {
> >  }
> >
> >  public void OnStartupComplete(ref System.Array custom)
> >  {
> >  }
> >
> >  public void OnBeginShutdown(ref System.Array custom)
> >  {
> >  }
> >		
> >  private Microsoft.Office.Core.CommandBar
> >	AddWordToolbar(Word.Application word, string toolbarName) 
> >  {
> >    Microsoft.Office.Core.CommandBar toolBar = null;
> >    try 
> >    {
> >      object missing = System.Reflection.Missing.Value;
> >      toolBar = (Microsoft.Office.Core.CommandBar)
> >      wordApp.CommandBars.Add(toolbarName,
> >	Microsoft.Office.Core.MsoBarPosition.msoBarTop, 
> >	missing, true );
> >      toolBar.Visible = true;
> >      return toolBar;
> >    }
> >    catch (Exception ee)
> >    {
> >      System.Windows.Forms.MessageBox.Show(ee.Message);
> >      return null;
> >    }
> >  }
> >
> >  private object applicationObject;
> >  private object addInInstance;
> >  private Word.Application wordApp = null;
> >}
> >}
> 
>
date: Thu, 3 Nov 2005 03:02:04 -0800   author:   - B@rney

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us