Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Tue, 19 Aug 2008 21:46:13 +0200,    group: microsoft.public.vsnet.vstools.office        back       


CustomizationContext - The neverending story   
Hi all,

I am converting a COM-addin developed with VB6 to a VSTO addin
with VB.NET 2008.
Again, I am encountering problems with the customization context.
See my implementation below.

The addin specific menu appears for a millisecond
when starting the addin in debug mode, but immediately disappears.

What's causing this behaviour?
Thanks in advance for your answers.

Best regards
Bernd

===========================================================================
Protected Overrides Sub InitializeUserInterface()

Dim FName As String _
        = ApplSettings.Files.WordCustomizationContext.Pathname
If IO.File.Exists(FName) Then
   Dim OldCustomizationContext As Object _
        = MyOfficeApplication.CustomizationContext

   With MyOfficeApplication
     .AddIns.Add(FileName:=FName), Install:=True)
     MyContextTemplate = .Templates(FName)
     .CustomizationContext = MyContextTemplate
   End With

   ' Adds a menu to the active commandbar.
   MyBase.InitializeUserInterface()

   MyContextTemplate.Saved = True

   ' Restore old customization context to avoid that the addin
   ' specific context is accidently used by foreign addins.
   MyOfficeApplication.CustomizationContext = OldCustomizationContext
End If

End Sub
date: Tue, 19 Aug 2008 21:46:13 +0200   author:   Bernd Schend

Re: CustomizationContext - The neverending story   
I forgot to mention: it's a Word addin :-)

Bernd Schend schrieb:
> Hi all,
> 
> I am converting a COM-addin developed with VB6 to a VSTO addin
> with VB.NET 2008.
> Again, I am encountering problems with the customization context.
> See my implementation below.
> 
> The addin specific menu appears for a millisecond
> when starting the addin in debug mode, but immediately disappears.
> 
> What's causing this behaviour?
> Thanks in advance for your answers.
> 
> Best regards
> Bernd
> 
> ===========================================================================
> Protected Overrides Sub InitializeUserInterface()
> 
> Dim FName As String _
>        = ApplSettings.Files.WordCustomizationContext.Pathname
> If IO.File.Exists(FName) Then
>   Dim OldCustomizationContext As Object _
>        = MyOfficeApplication.CustomizationContext
> 
>   With MyOfficeApplication
>     .AddIns.Add(FileName:=FName), Install:=True)
>     MyContextTemplate = .Templates(FName)
>     .CustomizationContext = MyContextTemplate
>   End With
> 
>   ' Adds a menu to the active commandbar.
>   MyBase.InitializeUserInterface()
> 
>   MyContextTemplate.Saved = True
> 
>   ' Restore old customization context to avoid that the addin
>   ' specific context is accidently used by foreign addins.
>   MyOfficeApplication.CustomizationContext = OldCustomizationContext
> End If
> 
> End Sub
date: Tue, 19 Aug 2008 21:52:39 +0200   author:   Bernd Schend

Google
 
Web ureader.com


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