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

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.


Get Sender SMTP Address for Other Accounts in ItemSend event

$
0
0
I'm trying to pickup the Sender's Email Address in the ItemSend event for Account Type 'Other'.   (Outlook 2007 and 2010 VSTO) 

The sendusingaccount.smtpaddress as well as the username is blank, so I need some alternate method.  I did some testing using a hotmail account (Outlook Connector).  Not sure where the email address is stored.

Thanks

Unable to cast COM object of Office Interop Word

$
0
0

I got this error after update office from 2010 to 2013

Here is the reference i used

Here is the code

Microsoft.Office.Interop.Word.Application appVersion = new Microsoft.Office.Interop.Word.Application();
appVersion.Visible = false;

and this is the error message:

Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

I try to check {00020970-0000-0000-C000-000000000046} in registry but can't find anything.

Please help. Thanks

changing .Net framework 4.0 client profile to 3.5 of VSTO project

$
0
0

My VSTO 2010 project is built in .Net framework 4.0 client profile.

When I use microsoft.sharepoint dll in my project it gives an error: "The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)".

This error is removed after changing .net framework to 3.5. Can I resolve this error without changing my current .net framework to 3.5 and or is it possible to change .Net framework 4.0 client profile to .Net framework 3.5?

Best Regards,

Saurabh

 

when to release outlook add-in object?

$
0
0

Hi team,

I defined some MAPIFolder object at the class level, when should i release them?

    public partial class ThisAddIn
    {
        private MAPIFolder favouritesFolder = null;

     }

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

mailItem.Recipients will not always get the current value

$
0
0

For my add-in I want to allow users to enter a phone number in the To field so that it will look like "Jim@Jim.com; 9025555555;" When I do this and read mailItem.recipients I only get Jim@Jim.com.

Now, I can force a refresh causing mailItem.recipients to see both entries by doing one of the following:

  1. Hitting the To button and bringing up the address book (No further action there required, I can exit out immediately and trigger my plugin, mailItem.Recipients will now have the phone number added to it when read.
  2. Adding a proper email address following the phone number such as "Jim@Jim.com; 9025555555; Bob@Bob.com". When I look at mailItem.Recipients there will be the 3 entries I was expecting.
  3. Adding a breakpoint in code and looking at mailItem.Recipients directly before it is read

I have also tried reading mailItem.To but it is always set to Nothing (Unless workaround #3 i used) but I imagine that's expected since it's used for changing the recipients.

Is there a way I can get around this and force the mailItem to refresh the To field myself?


Change Bold font for part of text in textbox in Word document with visual studio 2012 C#

$
0
0

I try to create textbox in word document that have part of text with bold and part of text regular.

Here is part of code:

 Microsoft.Office.Interop.Word.Shape shipbox = Doc.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 400F, 100F, 150F, 30F, objMiss);
                shipbox.TextFrame.ContainingRange.Text = "FREE Shipping";

I want to the word "FREE" is bold.

How I can do this? 


Office 2003 32Bit On Windows Server2008

$
0
0

Hi,

I deployed Vsto 2003 to many machines and it's fine,

But on windows server2008 Or Windows Server2003 64Bit With Microsoft Office2003 32Bit

It doesn't work and i accept the following exception when opening the word :

"Failed to grant permission to execute. (Exception from HRESULT: 0x80131418) ...."

I set full trust to word documents and i add msosec.dll from office11 to the assembly cache at caspol,

And the same error i still accept, What is the problem and how can i fix it.

Thnx,
khalil

Stop a cell from being in edition in Excel VSTO Add-in

$
0
0

We have an Excel VSTO Add-in with a ribbon menu. When a user clicks on one of the buttons of the menu, some properties like "_Application.Interactive" are set to false and then some heavy worksheet manipulations are started.

A problem occurs when the user clicks on the button while he's editing a cell.As you probably already know, the Interactive property can't be assigned while a cell is in edition, but I haven't found a way to stop edition programmatically. One would expect edition to stop when the users clicks on a ribbon button, but unfortunately that doesn't happen.

How can I solve this issue using Excel Interop 2007?

Thanks

Highlighting many ranges slows down

$
0
0

We have a Word addin.  we need to highlight a list of ranges.  Sometimes there are few, sometimes there are many.  When we highlight a few ranges(up to 50) each execution of:

range.HighlightColorIndex = color;

takes a negligible amount of time.  However as we continue highlighting more ranges, the time increases.  In a recent run of about 500 ranges, towards the end of the processing, each call was taking about .5 seconds.  

One time I saw that a call to clear the highlighting in one range of 4 characters(it was in a table) took 14 seconds!

Word must be doing a lot of processing on these calls.  I wonder if there is a setting in Word which could turn this off until all highlighting is finished and then turn it back on.  

Powerpoint add-on project

$
0
0

Hi,

I am developing a powerpoint add on in C#.  Is there any event or code for creating a menu with buttons or just buttons to control the add on specifically?

Thanks,

Parent word document freezes when word document is produced from its addin

$
0
0

I have a word add in where it loads the web browser dialog which connects to share point site, from there i can select the custom templates which we have to create a word document. after it creates new word document it should close the dialog instead it is freezing the dialog also the parent word documents stops responding. The same behavior works well in IE and other addins(excel, powerpoint and outlook).

function SI_BIF_ProduceFile(strFileUrl) {
 debugger;
   var obj = new ActiveXObject('SharePoint.OpenDocuments.3');
   obj.EditDocument(strFileUrl);
}

The above is the code which generates the word document.

If anyone has any idea please suggest, looks like a know issue but i didn't find any solution yet.

Thanks in advance.

How to sort an outlook folder collection?

$
0
0

Hi team,

When i add sub Folders to MAPIFolder collection, the sub folders are sorted when i see from the panel.

For example:

when i add folder  b, e , a to folder c.

The expected order from the panel are b, e, a.

But i see the sub folders under folder c are a, b, e.

How can i keep the order at the outlook panel as i added?

Microsoft.Office.Interop error 0x800401E3

$
0
0

I am trying to access Microsoft word instance through my service (windows service) but I am getting this error

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) ,

 I have opened word document ( i can also see WINWORD.EXE in Task Manager) ,

I am using VS 2010 and MS Office 2003. Here is my code

 

              

Dim fs As New FileStream("D:\log.txt", FileMode.OpenOrCreate,
FileAccess.Write)            Dim sw As
New StreamWriter(fs)           
sw.BaseStream.Seek(0, SeekOrigin.End)            Dim
wordapp As Word.Application            wordapp = Marshal.GetActiveObject("Microsoft.Office.Interop.Word.Application")            For Each
doc As Word.Document In wordapp.Documents               
sw.WriteLine(doc.FullName.ToString() + "\n" +               
doc.ActiveWindow.WindowState.ToString())            Next            sw.Flush()            sw.Close()

 

if i use this code in windows form application it works perfect, but doesn’t works in windows service.Why is that for ? Windows Service Doesn’t support Microsoft.Office.Interop ? If it does work please guide.


Word 2013 Actions Pane error

$
0
0

Hi,

I have a VSTO Word document-level project that was originally written in Visual Studio 2010 that targeted Word 2007. I have converted the project for Visual Studio 2013, targeting Word 2013.  It's a C# app using the 4.51 .NET framework.

The project has an Action Pane that worked fine in Word 2007, but when I try to open the Action Pane in Word 2013, I get this error:

"You are currently viewing this document in multiple windows. To attach an XML expansion pack, you must first close all additional windows so that you are viewing the document in only one window."

I have a checkmark control on my Ribbon that users can click to open/close the Action Pane.

I don't have any other windows open. I haven't split the document view.

If I manually switch the view from Print Layout to Draft and then click the checkbox to open the Action Pane, it works fine. So, I tried changing the view to Draft View in my C# code and then opening the Task Pane, but I still get the error. In other words, if I switch the view using the Word UI, it works. But if I switch the view in my code, it doesn't.

I've seen several reference on this forum of other people getting the error, but that was in Word 2003 and it looks like a service pack fixed the bug.

Any ideas would be most appreciated.

Is there a property in an Outlook Item that has a time stamp?

$
0
0

A project I'm working on is requiring that we know when a calendar Item has been updated.  

Is there some property that I can read?  If not, that's fine.

 I can always create the property myself and provide the timestamps.  However, I don't want to re-create the wheel.  If it already exists I'd like to take advantage of the object model.

How to extract the Object from Clipboard in excel 2010 64 bit.

$
0
0
Hi,
In my application extracting the object(*.m) present in excel 2003 32 bit is worked by using following code.

IDataObject iData = Clipboard.GetDataObject();

if (iData != null)
{
    string name = iData.ToString();
    string objType = "Native";
    object objToSave = iData.GetData(objType);
}

but the same code fails to extract the object present in excel 2010 64 bit in windows 7 64 bit version because "iData.GetData(objType)" returns null.

How to handle this scenario and extract the object in excel 2010.

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.

Excel.Style for Border

$
0
0

Hi All,

I want to create a Excel Style to apply it on a lot of cells previously I was using BorderAround method of Range object and I want to achieve same functionality with Excel Style So here's my code for that:

Excel.Style poValueStyle = ActiveWorkbook.Styles.Add("POValueStyle");
            poValueStyle.IncludeBorder = true;
            poValueStyle.Borders[(Excel.XlBordersIndex)Excel.Constants.xlTop].LineStyle = Excel.XlLineStyle.xlContinuous;
            poValueStyle.Borders[(Excel.XlBordersIndex)Excel.Constants.xlBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
            poValueStyle.Borders[(Excel.XlBordersIndex)Excel.Constants.xlLeft].LineStyle = Excel.XlLineStyle.xlContinuous;
            poValueStyle.Borders[(Excel.XlBordersIndex)Excel.Constants.xlRight].LineStyle = Excel.XlLineStyle.xlContinuous;
            poValueStyle.Borders.Weight = Excel.XlBorderWeight.xlThin;
            poValueStyle.Borders.ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic;

What happens is this that it gives me border around cell and also diagonally and I don't want diagonal border.  

Thanks,


Attiqe Ur Rehman

Viewing all 5157 articles
Browse latest View live


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