Quantcast
Channel: Visual Studio Tools for Office (VSTO) forum
Viewing all 5157 articles
Browse latest View live

non-modal not retains focus when changing documents

$
0
0

Hi,

I'm developing Word Add-In in C#. 

I have a non-modal dialog that is opened from a particular document. If I have another document open, when i'm switching to it (while the dialog is still open on the other document) and going back to the original document, the dialog loses its focus.

This not happens when switching between other programs, only on Word documents change. 

How can I make it to retain the focus when changing back? I tried with 

myDialog.BringToFront();


and

myDialog.Focus();

But no luck.

Is is something I did that caused to this behavior or this is how it normally works in VSTO (in VBA it works just fine).

Thanks.


Remoting, Interface

$
0
0

Hi!

I have a Server with dynamic publication of my remoted object. this object inheritable from MarshalByRefObj. There is the method in the object which return another  interface (2). 

I can get interface of object using Activator.GetObject from client and call that object's methods that return differnt types, But when i try to call a method that returns interface (2) i get the error: "Return argument has an invalid type"

it works correctly from c#, but not using VBA. What's the difference and how can i solve this?

Thanks!


Accessing multiple Excel charts on one chart sheet in VSTO

$
0
0

Normally an Excel chart sheet contains only one chart. However, with a little trick it is possible to place several charts on a single chart sheet, see for example http://www.techrepublic.com/article/place-multiple-charts-on-a-chart-sheet-in-excel/

I have done this in a VSTO customization where I have two charts in one chart sheet. My problem is now that I need to format these charts at run time, but I’m unable to access them through VSTO. Does anyone know of a way?

VSTO-Addin - Calling Excel-Connection "breaks" Powerpivot

$
0
0

Hello!

I’m a struggling with an Excel automation problem. I was hoping someone can help me with that - any help is highly appreciated.

The setup is as follows: I’ve created a VSTO add-in (vb.net) that works for Excel 2010 and 2013. It supports typical BI tasks and makes use of WorkbookConnections. More precisely, it operates on a certain WorkbookConnection that the user has to select for a Workbook (in case there are more than one). When the user opens the Workbook, it reads some data model information from the connection using ADO.

With Excel 2013, a strange thing occurs if the add-in is operated on the built-in connection to the Excel (PowerPivot) Model (“ThisWorkbookDataModel”): The add-in works fine, but as soon as you try to open the PowerPivot window, a COM exception comes up (see bottom of Email). Afterwards, an exception is raised every time the Connection is used within the add-in, so you have to close and re-open Excel.

I’ve narrowed the problem down to this: Any time the Model gets loaded because of add-in code (e.g. calling “Globals.ThisAddin.Application.ActiveWorkbook.Model.Initialize()”, but also if you just loop through the list of WorkbookConnections), the connection somewhat breaks for PowerPivot with the above mentioned effect. Additionally, my testing revealed the following:

-         This does not happen if you do the same thing with a VBA macro

-         But if you call that macro from VSTO using “Globals.ThisAddIn.Application.Run(theMacro)”, it does happen

-         Only if you call the macro using the “SendKeys()”-command, the connection remains intact

Has anyone any idea what may cause this problem? Or, as a workaround, how it’s possible to initiate “good” Model initialization from the add-in similar to what is done by calling a VBA macro via SendKeys()? Obviously, programmatically adding a macro to the workbook and calling it with SendKeys is not really something you want to sell to customers… ;-)

Thanks and best regards,

Jutan

PS: The COM exception when opening the PowerPivot window:

============================

Error message:

============================

Object reference not set to an instance of an object.

============================

Call stack:

============================

   at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadSandboxAfterConnection(String errorCache)

   at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadSafeSandboxAfterConnection(String errorCache)

   at Microsoft.Office.PowerPivot.ExcelAddIn.InProcServer.LoadOLEDBConnection(Boolean raiseCompleteEvent, String errorCache)

============================

I want to ask about default button's id at ContextMenuFolder?

$
0
0

Hi team,

I want to know the idMso for the default button Process Marked Headers .

So i could hide this default button.Anyone has idea?


Outlook Application Level AddIn Registry Manifest Path

$
0
0

Hi,

we would like to install an Outlook addin on client 2010 and 2012.

For this purbose we created a setup which delivered the dlls, vsto file and the manifest.

In the registry we have the following keys in HKLM\ .... Outlook\Addin:

  • Description
  • FriendlyName
  • LoadBehavior
  • Manifest

Our current problem is our installation path: Our company name includes an '&' sign. This is used also in the manifest path.

If you try to start outlook you get:

************** Exception Text **************
System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

If we use a path without '&' sign everything is working. Can we get around this problem?

Thanks in advance!

BR

PS: http://blogs.msdn.com/b/brijs/archive/2008/10/31/bug-vsto-3-0-msi-value-does-not-fall-within-the-expected-range-after-installing-vsto-3-0-msi-package-for-outlook-2007.aspx

Late-bound Event Sink: works with Word, not with Outlook. Why?

$
0
0

Dear friends, I need your help with solving this puzzle.

I wanted to wrap Word and Outlook interop code in classes that work regardless of Office Version on target user machines.
For that reason, I chose late binding instead of adding reference to a specific PIA.

Much with help of examples found on web, I wrote two classes, AutoWord and AutoOutlook, and their code follows below. Both execute well, that is, both run their commands against both Word and Outlook, so I can open documents and send e-mails, ok.

But I also wanted to listen to some events raised by these external applications. So I also included implementation for Event Interfaces of both applications, from their GUID, and their events DispId. Once again, I relied a lot on samples found in the web.

What puzzles me, however, is that only AutoWord worked fine, and I can listen to MS-Word events. AutoOutlook, in the other hand, fails on executing the IConnectionPoint.Advise command, which would link it to the Event Sink.

If I comment and neutralize that single line, the class starts to work, but event-deaf.

Can someone point what is going wrong here?

Thank you very much!


Class AutoWord

    Imports System.Reflection
    Imports System.Runtime.CompilerServices
    Imports System.Runtime.InteropServices<ClassInterface(ClassInterfaceType.None)> _
    Public Class AutoWord
        Implements IApplicationEvents2
        Implements IDisposable
        Private wordApplication As Object
        Private mConnectionPoint As ComTypes.IConnectionPoint
        Private mSinkCookie As Integer
        Public Sub New()
            Renew()
        End Sub
        Private Sub Renew()
            wordApplication = CreateObject("Word.Application")
            DirectCast(wordApplication, ComTypes.IConnectionPointContainer).FindConnectionPoint( _
               GetType(IApplicationEvents2).GUID, mConnectionPoint)
            mConnectionPoint.Advise(Me, mSinkCookie)
            wordApplication.Visible = True
        End Sub
        Public Sub Close()
            overrideDocumentBeforeClose = True
            wordApplication.Documents.Close(0)
            wordApplication.Quit(0)
            wordApplication = Nothing
        End Sub
        Public ReadOnly Property Active As Boolean
            Get
                Return wordApplication IsNot Nothing
            End Get
        End Property
        Public ReadOnly Property Documents() As String()
            Get
                Dim DD As New List(Of String)
                Dim DC As Integer = wordApplication.Documents.Count()
                Dim DI As Object
                If DC > 0 Then
                    For i = 1 To DC
                        DI = wordApplication.Documents.Item(i)
                        DD.Add(DI.Name)
                    Next
                End If
                Return DD.ToArray
            End Get
        End Property
        Public Function AddDocument(ByVal full_name As String) As String
            Dim DI As Object = Nothing
            Try
                DI = wordApplication.Documents.Add(full_name)
            Catch ex As Exception
            End Try
            If DI IsNot Nothing Then Return DI.Name
            Return Nothing
        End Function
        Public Function OpenDocument(ByVal full_name As String) As String
            Dim _objDocument As Object = Nothing
            Dim _fileName As Object = full_name
            Dim _confirmConversions As Object = False
            Dim _readOnly As Object = False
            Dim _addToRecentFiles As Object = False
            Dim _revert As Object = False
            Dim _format As Object = 0
            Dim _encoding As Object = 50001
            Dim _visible As Object = True
            Dim _openAndRepair As Object = True
            Dim _documentDirection As Object = 0
            Dim _nNoEncodingDialog As Object = True
            Try
                _objDocument = wordApplication.Documents.Open(_fileName, _confirmConversions, _readOnly, _addToRecentFiles, , , _revert, , , _format, _encoding, _visible, _openAndRepair, _documentDirection, _nNoEncodingDialog)
            Catch ex As Exception
                Stop
            End Try
            If _objDocument IsNot Nothing Then Return _objDocument.Name
            Return Nothing
        End Function
        Public Sub SaveDocument(ByVal item_name As String)
            Dim DI As Object = Nothing
            Try
                DI = wordApplication.Documents.Item(item_name)
            Catch ex As Exception
            End Try
            If DI IsNot Nothing Then DI.Save()
        End Sub
        Public Function SaveDocumentAs(ByVal item_name As String, ByVal new_full_name As String) As String
            Dim DI As Object = Nothing
            Try
                DI = wordApplication.Documents.Item(item_name)
            Catch ex As Exception
            End Try
            If DI IsNot Nothing Then
                DI.SaveAs(new_full_name)
                Return DI.Name
            End If
            Return Nothing
        End Function
        Public Sub DocumentFindReplace(ByVal item_name As String, ByVal dfr As Dictionary(Of String, String))
            Dim SL = New List(Of Object), FI As Object
            Dim DI As Object = Nothing, SC As Integer
            Try
                DI = wordApplication.Documents.Item(item_name)
            Catch ex As Exception
            End Try
            If DI IsNot Nothing Then
                SC = DI.StoryRanges.Count
                If SC > 0 Then
                    For i = 1 To SC
                        SL.Add(DI.StoryRanges.Item(i))
                    Next
                End If
            End If
            Dim _findText As Object
            Dim _matchCase As Object = False
            Dim _matchWholeWord As Object = False
            Dim _matchWildcards As Object = False
            Dim _matchSoundsLike As Object = False
            Dim _matchAllWordForms As Object = False
            Dim _forward As Object = True
            Dim _wrap As Object = 1
            Dim _format As Object = False
            Dim _replaceWith As Object
            Dim _replace As Object = 2
            Dim _matchKashida As Object = False
            Dim _matchDiacritics As Object = False
            Dim _matchAlefHamza As Object = False
            Dim _matchControl As Object = False
            For Each SR In SL
                FI = SR.Find
                For Each KVP In dfr
                    _findText = KVP.Key
                    _replaceWith = KVP.Value
                    FI.Execute(
                        _findText,
                        _matchCase,
                        _matchWholeWord,
                        _matchWildcards,
                        _matchSoundsLike,
                        _matchAllWordForms,
                        _forward,
                        _wrap,
                        _format,
                        _replaceWith,
                        _replace,
                        _matchKashida,
                        _matchDiacritics,
                        _matchAlefHamza,
                        _matchControl)
                Next
            Next
        End Sub
        Public Event Quit(ByVal sender As Object, ByVal e As EventArgs)
        Public Sub OnQuit() Implements IApplicationEvents2.Quit
            wordApplication = Nothing
            RaiseEvent Quit(Me, New EventArgs)
        End Sub
        Public Event DocumentChange(ByVal sender As Object, ByVal e As EventArgs)
        Public Sub OnDocumentChange() Implements IApplicationEvents2.DocumentChange
            RaiseEvent DocumentChange(Me, New EventArgs)
        End Sub
        Public Event DocumentOpen(ByVal sender As Object, ByVal e As DocumentOpenEventArgs)
        Public Sub OnDocumentOpen(ByVal doc As Object) Implements IApplicationEvents2.DocumentOpen
            RaiseEvent DocumentOpen(Me, New DocumentOpenEventArgs(doc))
        End Sub
        Public Class DocumentOpenEventArgs
            Inherits EventArgs
            Public Sub New(ByVal document As Object)
                _doc = document
            End Sub
            Private _doc As Object
            Public ReadOnly Property Document As Object
                Get
                    Return _doc
                End Get
            End Property
        End Class
        Private overrideDocumentBeforeClose As Boolean
        Public Event DocumentBeforeClose(ByVal sender As Object, ByVal e As DocumentBeforeCloseEventArgs)
        Public Sub OnDocumentBeforeClose(ByVal doc As Object, ByRef cancel As Boolean) Implements IApplicationEvents2.DocumentBeforeClose
            Dim DBCEA = New DocumentBeforeCloseEventArgs(doc)
            RaiseEvent DocumentBeforeClose(Me, DBCEA)
            cancel = DBCEA.Cancel And Not overrideDocumentBeforeClose
        End Sub
        Public Class DocumentBeforeCloseEventArgs
            Inherits EventArgs
            Public Sub New(ByVal document As Object)
                _doc = document
            End Sub
            Private _doc As Object
            Public ReadOnly Property Document As Object
                Get
                    Return _doc
                End Get
            End Property
            Public Property Cancel As Boolean
        End Class
    #Region "IDisposable Support"
        Private disposedValue As Boolean
        Protected Overridable Sub Dispose(ByVal disposing As Boolean)
            If Not Me.disposedValue Then
                If disposing Then
                    RemoveConnection()
                End If
                If Me.Active Then Me.Close()
            End If
            Me.disposedValue = True
        End Sub
        Public Sub Dispose() Implements IDisposable.Dispose
            Dispose(True)
            GC.SuppressFinalize(Me)
        End Sub
        Public Sub RemoveConnection()
            If mConnectionPoint IsNot Nothing AndAlso mSinkCookie <> 0 Then
                mConnectionPoint.Unadvise(mSinkCookie)
            End If
            mConnectionPoint = Nothing
            mSinkCookie = 0
        End Sub
    #End Region<ComImport(), Guid("000209FE-0000-0000-C000-000000000046"), TypeLibType(CShort(4304))> _
        Private Interface IApplicationEvents2<MethodImpl(MethodImplOptions.InternalCall), DispId(2)> _
            Sub Quit()<MethodImpl(MethodImplOptions.InternalCall), DispId(3)> _
            Sub DocumentChange()<MethodImpl(MethodImplOptions.InternalCall), DispId(4)> _
            Sub DocumentOpen(<InAttribute(), MarshalAs(UnmanagedType.Interface)> ByVal doc As Object)<MethodImpl(MethodImplOptions.InternalCall), DispId(6)> _
            Sub DocumentBeforeClose(<InAttribute(), MarshalAs(UnmanagedType.Interface)> ByVal doc As Object,<InAttribute(), Out(), MarshalAs(UnmanagedType.Interface)> ByRef cancel As Boolean)
        End Interface
    End Class

Class AutoOutlook

    Imports System.Reflection
    Imports System.Runtime.CompilerServices
    Imports System.Runtime.InteropServices<ClassInterface(ClassInterfaceType.None)> _
    Public Class AutoOutlook
        Implements IApplicationEvents
        Implements IDisposable
        Private outlookApplication
        Private outlookNamespace As Object
        Private mConnectionPoint As ComTypes.IConnectionPoint
        Private mSinkCookie As Integer
        Public Sub New()
            Renew()
        End Sub
        Private Sub Renew()
            Try
                outlookApplication = GetObject(, "Outlook.Application")
            Catch ex As Exception
                outlookApplication = CreateObject("Outlook.Application")
            End Try
            TryCast(outlookApplication, ComTypes.IConnectionPointContainer).FindConnectionPoint( _
               GetType(IApplicationEvents).GUID, mConnectionPoint)
               ' mConnectionPoint.Advise(Me, mSinkCookie)
               ' the line above doesn't execute in this class and I don't know why
            outlookNamespace = outlookApplication.GetNamespace("MAPI")
            outlookNamespace.Logon()
        End Sub
        Public ReadOnly Property Active As Boolean
            Get
                Return outlookApplication IsNot Nothing
            End Get
        End Property
        Public Sub Test()
            Dim PF = outlookNamespace.PickFolder
            Stop
        End Sub
        Public Function SendMessageHTML(ByVal _to As String, ByVal _subject As String, ByVal _htmlBody As String, ByVal _attachments As String()) As Boolean
            Try
                Dim olMail As Object
                olMail = outlookApplication.CreateItem(0)
                olMail.To = _to
                olMail.Subject = _subject
                olMail.BodyFormat = 2
                olMail.HTMLBody = _htmlBody
                For Each _file In _attachments
                    If IO.File.Exists(_file) Then
                        olMail.Attachments.Add(_file, 1)
                    End If
                Next
                olMail.Send()
                olMail = Nothing
                Return True
            Catch ex As Exception
                Return False
            End Try
        End Function<ComImport(), Guid("0006304E-0000-0000-C000-000000000046"), TypeLibType(CShort(4304))> _
        Private Interface IApplicationEvents<MethodImpl(MethodImplOptions.InternalCall), DispId(61442)> _
            Sub ItemSend(<InAttribute(), MarshalAs(UnmanagedType.Interface)> ByVal item As Object,<InAttribute(), Out(), MarshalAs(UnmanagedType.Interface)> ByRef cancel As Boolean)<MethodImpl(MethodImplOptions.InternalCall), DispId(&HF003)> _
            Sub NewMail()<MethodImpl(MethodImplOptions.InternalCall), DispId(&HF006)> _
            Sub Startup()<MethodImpl(MethodImplOptions.InternalCall), DispId(&HF007)> _
            Sub Quit()
        End Interface
        Private Sub OnStartup() Implements IApplicationEvents.Startup
            Stop
        End Sub
        Private Sub OnQuit() Implements IApplicationEvents.Quit
            Stop
        End Sub
        Private Sub OnItemSend(ByVal item As Object, ByRef cancel As Boolean) Implements IApplicationEvents.ItemSend
            Stop
        End Sub
        Private Sub OnNewMail() Implements IApplicationEvents.NewMail
            Stop
        End Sub
    #Region "IDisposable Support"
        Private disposedValue As Boolean
        Protected Overridable Sub Dispose(ByVal disposing As Boolean)
            If Not Me.disposedValue Then
                If disposing Then
                    RemoveConnection()
                End If
            End If
            Me.disposedValue = True
        End Sub
        Public Sub Dispose() Implements IDisposable.Dispose
            Dispose(True)
            GC.SuppressFinalize(Me)
        End Sub
        Public Sub RemoveConnection()
            If mConnectionPoint IsNot Nothing AndAlso mSinkCookie <> 0 Then
                mConnectionPoint.Unadvise(mSinkCookie)
            End If
            mConnectionPoint = Nothing
            mSinkCookie = 0
        End Sub
    #End Region
    End Class

want to add signatureline in powerpoint slide.

$
0
0

hi,

i have inquired that power-point don't support adding signature-line..

why and how can we achieve it....

invisible signature is something i am not looking at this time.


Haseeb Hasan Principle Software Engineer Ascertia Pvt Ltd


Automating Word Mail merge from ASP.NET application

$
0
0
I am search for a solution that requires an intranet application (asp.net)  to launch word 2007 after performing a mail merge operation.  My data is retrieved from an XML webservice and the document that gets merged varies based on the data received.

The end user needs to be able to edit the final merged document on the fly so word 2007 needs to be launched after the merge has taken place.

I have reserached trying to use Word Template projects (we use visual studio 2008), creating word merged documents in vb.net etc even trying to perform a mail merge using java script. Does anyone know of a good clean solution to the above?  There are possibly 300 documents I would need to support so the intranet applicatoin to do the merge seems the best route for this application.  I do not want to use VBA or any menuing systems within Word - this causes too much maintenance.  The end user needs to be able to create templates as well (they would like to manage these in word).

I see the intranet app doing the data retrieval, merging the document template and data then launching work and putting the user in the final document.  They would edit/print the final document at that point.

Please help!  Thanks.  Any refernece material would be welcome.
Al Penfound

AppointmentItems Properties in Shared Calendar

$
0
0

User B is a delegate of User A.

User B creates an appointment where User A is the Organizer and User B is a participant.

When User B deletes the appointment from his own Calendar the Folder.BeforeItemMove is fired.

In this event I inspect the AppointmentItem and I get the Organizer's Calendar and perform a search using Folder.Items.Find.

(I know I get the right event because I've made the subject a ridiculously silly string).


At this point I compare User B's AppointmentItem, to User A's AppointmentItem.

The subjects match, the Location's match and several other properties that are displayed match.

What doesn't match are the CreationTime, LastModificationTime, and GlobalAppointmentID are both different.

What's really surprising was that the GlobalAppointmentID's are different.  Is this because of the Items being moved to the Deleted Items folder?

Create a shortcut that start powerpoint add-in

$
0
0

Hi,

I developed a powerpoint add-in using c#,

I want to create a shortcut that start Powerpoint and load automatically this add-in.

When I start powerpoint without clicking on this shortcut, the add-in should not appear.

Any one can help me how to do this ?

Thank you so much.

Best regards.


Cannot set NumberFormat property in Excel from VB.Net

$
0
0

Hello,

I'm trying to write numbers from VB.Net code to Excel file, but I have problems with number formats. After a lot of trial and error, I copied the example inhttps://support.microsoft.com/kb/301982 but even that does not work. I can write numbers to excel cells, but when I try to set number format, I get a COM Exception shown below.

Any suggestions what is the problem?  

Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range

' Start Excel and get Application object.
oXL = CreateObject("Excel.Application")

' Get a new workbook.
oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet

oRng = oSheet.Range("D2", "D6")
oRng.Value = 123.45 
oRng.NumberFormat = "$0.00"

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2146827284
  HelpLink=xlmain11.chm
  Message=Unable to set the NumberFormat property of the Range class
  Source=Microsoft Excel
  StackTrace:
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at Microsoft.Office.Interop.Excel.Range.set_NumberFormat(Object )
       at Project.frmForm.cmdExport_Click(Object eventSender, EventArgs eventArgs) in...

I deploy a VSTO Word application and select to check for updates...

$
0
0

  every time the customization runs; this fails on Windows 7 but succeeds on XP.

Is there anything I can do to have it work on Win 7?

How to debug - Microsoft Excel is waiting for another application to complete an OLE action caused by my VSTO addin

$
0
0

I have developed a VSTO Excel addin for Excel 2007 with Visual Studio 2010.  The addin is used on a number of computers which use Windows 7 x64 with Office 2007.  Windows and Office are in German and English.

Every so often like maybe once a day Excel shows "Microsoft Excel is waiting for another application to complete an OLE action" clicking ok does not help and the message returns.  You must end the excel process to get out of the loop.

When it does happen it generally happens when a second xlxs file is being opened and that second file is being clicked on either from a network drive or from Outlook. People have told me that it will happen two times in a row and then Excel will work fine for the rest of the day.

Why do I think it is my app.  Well many other people dont have my Addin and they dont have the problem and it seems that when my addin is disabled then it does not happen.

I tried to zero in on the problem by reducing my code down to only this;

Private Sub ThisAddIn_Startup() Handles Me.Startup

        Dim smartTagFile As Microsoft.Office.Tools.Excel.SmartTag = Globals.Factory.CreateSmartTag("MYApp#MYApp_File_Smart_Tag", "MYApp File")

        smartTagFile.Expressions.Add(New Regex("(?<![A-Z\d])(?:(?:19|20)?\d\d[A-Z]\d{5}((\s\s?(?!WO|WE|EP)[A-Z]{2}(?![A-Z]{2})|(?:WO|WE|EP)[A-Z]{2}|(?:WO|WE|EP|[A-Z]{2}))(0[1-9]|1[0-5])?)?|(?:19|20)\d{7})(?!\d)"))


        IpasAkzAction = Globals.Factory.CreateAction("File Lookup.")

        smartTagFile.Actions = New Microsoft.Office.Tools.Excel.Action() {IpasAkzAction}

        Me.VstoSmartTags.Add(smartTagFile)

    End Sub

 Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown

end sub

This is all that is left in my addin.

Now when it is fully coded it calls my own .NET dll which is registered in the GAC.  Whilst the code above does not mention this I have tested two versions of my code 1 with my .dll referenced even though there is no code and 1 where it is not referenced and I think that the error happens when it is referenced but does not happen when it is not referenced, but I have only tested this on one computer with one person so far.

I have checked with the Fusion log and it reports that the Addin itself is being loaded properly.

So I would love to ask what is causing the error but after reading may of the posts on this error message I have not read a single answer that directly solved the problem.

So I will try another way.  What programs can I use to debug excel for such problems like this?  They must be able to work on a non-development computer.

PowerPoint undo stack will be clear after add customXmlParts to Slide/Shape

$
0
0

I'm using Office 2010 and VS 2012.

I have a plugin of PowerPoint, if I add some custom data to shape or slide, the current undo stack will be cleared.

My code was written in C#, like bellow.

some powerpoint shape.CustomerData.Add();

I tested in VBA, also has this issue.

I'm asking is this a Microsoft Office Team bug? Can I get this work?

I believe this is broken by one of office upgrade.


Creating a Group Content Control without making a selection first

$
0
0

Hi,

So far I've only been able to add a GroupContentControl by first making a selection to define the range and then adding it to the selection range like this example:

http://msdn.microsoft.com/en-us/library/bb386181.aspx

ie

    Dim range1 As Word.Range = VstoDocument.Paragraphs(1).Range
    range1.Select()
    groupControl1 = VstoDocument.Controls.AddGroupContentControl("groupControl1")

However creating selections to do it creates a messy look as you see each selection before the control is added, plus it moves the cursor from it's previous position.

I've tried to define the range through the addGroupContentControl Method (range, string). However it still requires a range to be selected in my document otherwise it results in the following error:


"This method or property is not available because the current selection is locked for editing"

This seems to be suggested as a requirement on the following page according to the example given without explicitly ruling it out:

http://msdn.microsoft.com/en-us/library/bb398670.aspx

Is there a way of doing this without selecting a part of the document?


WIX installation failed while installing VSTO 4.0 Runtime.

$
0
0

Hi,

I've created a WIX (v3.7.0.0) installer for our VSTO application on Win 7 64 bit machine. Which do custom installation successfully. And I’ve also create Bundle.wxs file for installing the prerequisites for VSTO, like .Net Framework 4.0 client profile and VSTO 4.0. runtime.

When I run our exe file it search for VSTO and start download VSTO fromhttp://go.microsoft.com/fwlink/?LinkId=158917. but gives the below error

[0BE8:06F0][2013-08-06T10:49:18]e000: Error 0x80070490: Failed to find expected public key in certificate chain.

[0BE8:06F0][2013-08-06T10:49:18]e000: Error 0x80070490: Failed to verify expected payload against actual certificate chain.

[0BE8:06F0][2013-08-06T10:49:18]e000: Error 0x80070490: Failed to verify signature of payload: VSTORuntime

[0BE8:06F0][2013-08-06T10:49:18]e310: Failed to verify payload: VSTORuntime at path: C:\ProgramData\Package Cache\.unverified\VSTORuntime, error: 0x80070490. Deleting file.

[0BE8:06F0][2013-08-06T10:49:18]e000: Error 0x80070490: Failed to cache payload: VSTORuntime

[15CC:0568][2013-08-06T10:49:18]e314: Failed to cache payload: VSTORuntime from working path: C:\Users\UA17C9~1.JAI\AppData\Local\Temp\{f3bea074-7c76-4831-b8ed-22021127ba0d}\VSTORuntime, error: 0x80070490.

[15CC:0568][2013-08-06T10:49:18]e349: Application requested retry of payload: VSTORuntime, encountered error: 0x80070490. Retrying...

Installer do above same step for 3 times and then finally show error message and stop the installation.

Don’t know why this is happening. And we need to install VSTO 4.0 Runtime automatically.

Any help appreciated.

Thanks in advance.

VSTO Word 2010 Add-in delete custom control when track changes is on failed. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

$
0
0

Hello,

We are developing Word 2010 Add-in. The addint adds some costom WinForms controls in VSTO Document.Controls collection. In general those controls provide UI to guide the user during document editing.

In general workflow is as follow: 

1. The Add-in adds custom WinForms controls inside document content via Word.Tools.Document.Controls.Add method.

2. At some point user clicks on button on WinForms controls and Add-in removes the same control from document content.

3. If needed the steps 1 and 2 are repeated for other paragraphs.

Everything works fine except we face really strange exception. Before step 2 (user moves to next control) if users turn on Track Changes, Word.Tools.Document.Controls.Delete throws exception System.UnauthorizedAccessException

System.UnauthorizedAccessException occurred
  HResult=-2147024891
  Message=Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  Source=""
  StackTrace:
       at Microsoft.Office.Interop.Word.Shape.Delete()
       at Microsoft.Office.Tools.Word.ControlCollectionImpl.DestroyWrapper(String cookie)
  InnerException: 

The strange thing is that if Track Changes have been turned on before step 1. Everything works just fine. Only when Track Changes is turned on between steps 1 and 2 it throws exception.

What can be the reason for this issue?

Best Regards

Veselin

COM Add-In did not appear on Windows Server 2003 first time

$
0
0

Hi,

I have my Excel COM Add-In developed in .VB.NET and deployed to Windows Server 2003 machine remotely. This Excel COM Add-In is loaded from another Excel add-in (*.xlam) through VBA code. When I opened thexlam file, the COM add-in did not appear, although the list in Excel COM Add-Ins displayed that the particular add-in was loaded. I am the administrator for your information.

When I ran Excel without restrictions (i.e. by unchecking the restrictions option after right-clicking Excel and selecting "Run as" option) and then opened thexlam file, the COM add-in did appear.

I closed Excel and then opened the xlam from the shortcut and the COM add-in still appeared. I logged off from the remote session, logged back in, opened thexlam file again (from the shortcut) and the COM add-in still appeared.

Does anybody have any idea, why the COM add-in did not load very first time when runningxlam from the shortcut?

Kind regards,
Misbah

Add a new address book in Outlook 2010 with VSTO and acces to this empty address book for add new contact and groups

$
0
0

Hi !

     I have built a little plugin for Outlook 2010 where I want create new empty address book and use it to add some contact and group.

For now my code Could connect on Outlook and add a new address book in the Contacts section with the name I push.

But when I try to add a new contact on it or a new group, the  new address book stay empty and my new contact or group are present on my default address book. 

I have search without success for now on internet to resolve my issue without success.

Here is a part of my working code, with this code I could add a new empty addressbook:

Outlook.NameSpace nameSpace = OutlookApp.GetNamespace("MAPI");
Outlook.Folder folderContact = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
Outlook.Folders contacts = folderContact.Folders;

  //Try to add the new addressbook  

try
{
  Outlook.Folder addressbook = contacts.Add("Contacts test", Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
  addressbook.ShowAsOutlookAB = true; // force display in Outlook Address Book  
}

catch (COMException exception)
  { //if already create show pop-up

if (exception.ErrorCode == -2147352567)
// Cannot create the folder.
  System.Windows.Forms.MessageBox.Show(exception.Message+"Already present !");
}

Now I search to force the connection to this new address book to import some email and built some groups.

This second part of my code work, but the new email contact is create in the default addressbook.

Same thing for the new distribution list... 

  // add new contact in the default addressbook

Outlook.ContactItem contact_new = OutlookApp.Application.CreateItem(Outlook.OlItemType.olContactItem) as Outlook.ContactItem;
contact_new.FirstName = "test contacts";
contact_new.Email1Address = "test_contact@test.com";*/

//Add a new group in the default adressbook

Outlook.DistListItem groupe_new = OutlookApp.Application.CreateItem(Outlook.OlItemType.olDistributionListItem) as Outlook.DistListItem;
groupe_new.DLName = "test groupe";

groupe_new.Save();

This two part of code work quickly and my new list and my new contact are create in my default addressbook.

How can I modify this code the force the creation of the contact and list in my  Contacts test addressbook ?

I have find this example in the internet, but the line  Outlook.ContactItem contact = address_Book.Items.Add;  is   

always in error... 

Outlook.Folder contact_nw = this.OutlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
Outlook.Folder address_Book = contact_nw.Folders.Add("Business Contacts", Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
address_Book.ShowAsOutlookAB = true; // force display in Outlook Address Book
Outlook.ContactItem contact = address_Book.Items.Add;
contact.FullName = "Custom Industries, Inc.";
contact.Email1Address = "sales@customindustries.com";
contact.Save(); */

Any suggestion to solve this problem are welcome !

Thank You

emarck

Viewing all 5157 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>