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

Error: Common Language Runtime detected an invalid program

$
0
0

Hello all,

We have a weird problem :)

We have an Excel VSTO application consisting of VB and a C# DLL. This work fine at 95% of our customers, now one large customer gets somewhere in the program the error :Common Language Runtime detected an invalid program.

I spoke to their ICT department and they are running Excel 2010, Windows 7, .net framework 4.5. They have tried it now on 2 machines and multiple spreadsheets all returning the same error.

He tried it with one of our (simple) excel workbooks. Now I do not yet have any idea where in the code this occurs, but can't find out a reason as well.

My first guess is that it is related to their environment (since our other customers don't have the problem.

Does anyone has any experience with this error?

regards

Arie


MailItem.GetInspector.WordEditor is NULL on Outlook 2013 AddIn all the time

$
0
0

I asked this question on stackoverflow, try my luck here as well since it is a little urgent.  Thanks in advance for your time. 

We have a C# Outlook Add-in which allows end user to click one button in Ribbon to insert some contents on new email. We are using MailItem.GetInspector.WordEditor to do so. However the weird thing is that our program is not able to get the WordEditor all the time. So far, it is only on my machine.

we would get exception like this

    System.Runtime.InteropServices.COMException (0x9CD04005): The operation failed.
       at Microsoft.Office.Interop.Outlook._Inspector.get_WordEditor()

the last 4 digit is always 4005 while the first 4 could be changing. The first 4 should refer to the component where the error occurred.

I installed the outlookspy on my machine and it could not get WordEditor as well.  
OutlookSpy

I did some search over internet and found out this link: system.Runtime.InteropServices.COMException (0xB5904005): The operation failed, so it suggests that we would get the WordEditor on Activate event to make sure WordEditor is fully initialized, however on new email, it should already be activated per our understanding unless we are missing something here. Plus I have run OUtlookSpy multiple times on a new email and each time WordEditor is null there. So it seems that it should not be initialization issue.

Could someone shed some lights on what we should investigate here?


Unable to import Outlook 2016 Form Region (.ofs) into Visual Studio 2015 with error:- The installation path for Office 15 cannot be determined

$
0
0

Hi,

Development Environment:

  • Windows 10
  • Visual Studio Community 2015 with update 1 (14.0.4720.00)
  • Office developer tools for Visual Studio 2015 (14.0.23513)
  • Latest Outlook 2016 (I assume this is click-to-run)

I am unable to import the Outlook form region (TaskFormRegion.ofs) I have created with the following error:

An error occurred while processing file "C:\TaskFormRegion.ofs)
Error: The installation path for Office 15 cannot be determined

In Configuring a Computer to Develop Office Solutions it states "Click-to-Run versions of Office 2010 applications are not supported." is this true for Office 2016 as well.

This post suggests running Visual Studio as an Admin. I've done this and I still get the same error.

Is anybody able to point me in the direction to solve this problem please?

I will continue to search myself and reply to this post if I work it out...

Thank you,

Paul

Unfortunately I can't put links in the body text:

Configuring a Computer to Develop Office Solutions - https://msdn.microsoft.com/en-us/library/bb398242.aspx

Post suggesting fun Visual Studio as Admin - https://social.msdn.microsoft.com/Forums/vstudio/en-US/e0a0cb52-041a-4ede-987a-d4195353c1e2/outlook-form-region-import-error-visual-studio-2015?forum=vsto


custom Word.CaptionLabel entries are not found using ActiveDocument.GetCrossReferenceItems(ref ...)

$
0
0

Hello,

I have a problem with my word VSTO add-in. I wrote the code with Visual Studio 2013 and Word 2013. Now I am using VS 15 and Office 2016. My add-in showed all references and caption labels in the word document. In Word 2016 I do not get any entries for custom caption labels, as the German "Abbildung" for figure.

Built in Word.CaptionLabel(s) are found, also WdReferenceType Enumerators. Hence, if the BuiltIn Property is false, there are no references found, even if there are captions added (e.g. to figures). It should return a object, which I can cast to a string[], but the returned array is empty.

To be clear: I do not mean the label itself. This is listed in Application.CaptionLabels.

I also noticed, that my intelli sense is putting out the usage should be await ActiveDocument.GetCrossReferenceItems(ref ...), but if I put it in this way I get an exception.

Any help would be much appreciated.

Best regards,

Andreas

UPDATE:

After trying something, it seems that this problem is concerning all CaptionLabels depending on the Office version used to create the document. If I use a document created with Word 2013 the caption labels are found, if I use a document created with Word 2016 no caption labels are passed using GetCrossReferenceItems method.

UPDATE 2:

After using Word 2016 a little bit more, it seems there are some bugs concerning caption labels. When I insert my caption label as above/below the whole caption text is inserted instead of the word "above" or "below". I hope some MS staff reads this and can forward the problem to the developers.

word automatic language detection issue

$
0
0

hi,

in my word vsto add-in, i place text on a document programmatically which is in the form of my local languages(Indian languages). Here, even the automatic language detection enabled, the word not at all detecting the language of the text that i've placed. Need help on how can i format the text or document that word detect the language itself. the text is in Unicode encoding. 

Which call back function or event handler will be called...?

$
0
0

hi again,

in my word vsto add-in program which contains a custom ribbon tab additional to office built in tabs. Here, when a user head to open existing document or create a new document by clicking the File Tab my custom tab and the other mso ribbons get invisible. At this point, in my ribbon program i want to do a specific work like hiding custom window which was presented to the user as result of choosing a custom checkbox. I don't know which event of microsoft.office.interop.word namespace will be triggered or which call back called. tried getVisible call back function of <tab> tag, no result. 

Can someone point me to the correct callback function or event handler to use when the user presses the built- in File tab.

Writing to log file

$
0
0

Hi,

What's the best way for an add-in to write ie: exception/event to a custom log file?

Thank you.

Migration of VSTO projects

$
0
0

Hi,

I'd like to know if there are some topics about steps for migration of VSTO projects :

  • Current : VS2010(.NET 3.5) with VSTO2010(v.10)
  • Target : VS2013(.NET 4.0) with VSTO2010(v.12)

Is there any prerequisite for this migration, what kind of issue can we experience, what particular element do we have to care about, etc...

Thanks,


Bookmark Range Object Being Deleted in Word

$
0
0

I have MouseHover and MouseLeave event handlers for a text box in a custom task pane. When the mouse hovers over the text box, I retrieve a previously stored bookmark control from the controls collection and temporarily modify its text content in the document itself. I then go through that text range and define smaller ranges so that I can highlight various parts of the text. When the MouseLeave event triggers, I restore the control's original text content by defining the control's range and setting its text. Up to here, the code works fine. However, when I hover over the text box again, I can still retrieve the same desired control, but now I get a COMException saying that its Range object has been deleted. Why is this happening, and what can I do to fix it?



refedit control in VSTO Excel Add-In

$
0
0

hi,

I'm trying to develop an Excel Add-in with VSTO and would like to implement refedit control which shrink the form and allow user to select a range for the data.

I'm able to add the control to my windows form, but it doesn't seem to be doing anything when i click on it.

I found an article that dated back at 2006 http://support.microsoft.com/kb/q281542/ says that it will not work.

But according to the article below it should work

http://social.msdn.microsoft.com/forums/en-US/vsto/thread/0f7494e8-17db-4d13-b48b-8c9f2900e4f1

Am I missing something?

Since it's been awhile now, wondering Microsoft is now supporting that capability?

Please help.

Insert Excel SpreadSheet

$
0
0

Hi,

I am trying to find a way to insert an excel spreadsheet on PowerPoint slide using VSTO (Office 2010) with VS2010. Similar to when I do the 'Insert -> Table -> Excel Spreadsheet'.

I did try this code:

 Dim oShape As PowerPoint.Shape = Nothing

 oShape = Application.ActiveSlide.Shapes.AddOLEObject(30, 70, 660, 440, "Excel.Sheet", "", Microsoft.Office.Core.MsoTriState.msoFalse, "", 0, "", Microsoft.Office.Core.MsoTriState.msoFalse)

it did generate a excel object but when I double click on it, I got an error:

"The server application, source file, or item can't be found, or returned an unknown error. You may need to reinstall the server application"

Can I ask what is the proper way to insert a blank excel spreadsheet using VSTO?

Thanks,

Chris

How to add custom Group in PowerPoint ribbon in TabChartToolsFormat tab.

$
0
0

I am trying to add my custom buttons and Controls inside Format tab which is dynamically added to the main Tab list when user inserts any chart and is selected.

I have followed this link but it's not getting added in Format Tab

https://msdn.microsoft.com/en-us/library/bb608593.aspx.

I guess when the code to load the Ribbon is run the Chart Tools| Format Tab is not there.

Please let me know how could this be achieved.

Thanks


Point5Nyble

Manage Outlook Add-Ins Programatically

$
0
0
We publish Outlook in a Citrix XenApp environment. The installation is shared by users with different needs. One of our departments would like to make use of a vendor supplied Outlook Add-In, but that add-in is only relevant to members of that department, and in fact will cause grief for non members as they will be prompted to log in to a system to which they have no access. I can enable or disable the add-in in question by manually going in to Outlook "Tools>Trust Center>Add-ins>Manage COM Add-ins" by simply checking or unchecking a box. What I need to figure out is how to do this programatically by script (or possibly GPO) so that the add-in is enabled for members of the department in question and disabled for everyone else. So far I have had no luck. I have compared the HKCU registry hive with the Add-In enabled and Disabled. There is one key that changes consistently when I do so, but changing that key programatically does not cause the add-in to become either enabled or disabled. What happens when I check or uncheck the box? Where is that information stored? How can I manipulate it?

Viewing Webhelp in a Microsoft Help Viewer

$
0
0
I have generated HTML Webhelp files via an Adobe authoring tool. However, I want the help to display in a single-pane viewer (with search field, home, print, and foward/back arrows displaying at top) similar to the way online help is displayed in Microsoft Office 2013. Does Microsoft have a help viewer that can be coded to call my HTML Webhelp content to display in the single-pane viewer? If so, how can I implement it?

How to Disable Shifting Of Cells within namedRange

$
0
0

Hi,

I do have requirement of stopping shifting of cells within our named ranges; as shifting of cells leads to data integrity issue in our application. Whole Objective is either user shall be able to add whole row or delete row but shifting of cells from insert or delete shall not be allowed in specific area of worksheet.

I have tried out alternate approach like Hiding Native Insert/Delete button and pushing our own custom buttons in row & cell context menu. but i am not able to disable shortcut keys like CTRL + & CTRL -.

Any quick help on this will be highly appreciated.

Thanks,

Bhavik Thakkar


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

RibbonEditBox events

$
0
0

Hello

I want to create outlook add-in. My add-in functionality is very similar to Search People box (when user type query, a form open and search result appear). some problems i have are :

1)Ribbon edit box doesn't has events like activate or focus

2)Ribbon edit box doesn't has location property (i need it to set my custom form location exactly under the edit box)

Grateful for any help. 

VSTOInstaller.exe - Entry Point Not Found error

$
0
0

Hi,

I am developing an VSTO addin for PowerPoint 2010 32bit using Visual Studo 2013 with Visual Basic on Windows 7 Pro. I have no problem on testing with my Win 7 + Office 2010 32bit machine, but when I published to an installation folder and tried to run the Setup.exe on couple Windows XP SP3 machine with Office 2010 32bit installed, I am getting this error:

"VSTOInstaller.exe - Entry Point Not Found error"

"The procedure entry point GetFileVersionInfoExW could not be located in the dynamic link library Version.dll"

All these XP machines had latest patches, .Net Framewark 4 and Microsoft Visual Studio 2010 Tools for Office Runtime (x86) version 10.0.60.724 installed.

I also tried older version of the "Visual Studio 2010 Tools for Office Runtime (x86) version", all gave me the same VSTOInstaller.exe error.

I also trying just run the VSTOInstaller.exe on command prompt, with the /?, same error.

I really don't know what to do next, and hoping someone can help.

Best,

Chris

Set the Focus to Microsoft Word when executed from a C# program

$
0
0

We use Microsoft.Office.Interop.Word to execute Microsoft Word from our Visual C# application. Our problem is about setting the focus to the Microsoft Word window. The problem occurs in Windows 7 only. In Windows 8.1 we have managed to set the focus to the Microsoft Word window. In Windows 7 we haven't: Microsoft Word is only displayed and highlighted in the taskbar but not automatically opened and put to front as a window. I have searched the Internet for solutions to this. There are a lot of threads about this topic, but none of the solutions we tried has led to success.

What we currently do:

After opening the document, we use these lines to display the window.

            word_app.Visible = true;             word_app.Activate();             word_app.WindowState = Word.WdWindowState.wdWindowStateMaximize;

To set the focus we write at the end of the method:

            Word.Window window = word_app.ActiveWindow;            window.SetFocus();            window.Activate();            if (window != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(window);

We are waiting for your quick response.

VSTO AddIn for Outlook displaying a WPF UserControl - how to react on closing of the window from the AddIn

$
0
0

Hello,

i have VSTO AddIn for Outlook displaying a WPF UserControl. How can i act when the windows from the AddIn Closes.

I use Office 2013 32 bit, Visual Studio 2015 Community, actual version of VSTO and Windows 10.

I tried the following in Ribbon.Xml1.cs:

public class MyElementHost : System.Windows.Forms.Integration.ElementHost {
        public const int WM_CLOSE = 0x10;
        protected override void WndProc(ref Message m) {
            if (m.Msg == WM_CLOSE) {
                System.Windows.Forms.MessageBox.Show("WM_CLOSE");
            }
            base.WndProc(ref m);
        }

 public void OnTextButtonClicked(Office.IRibbonControl control) {
            System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
            System.Windows.Forms.Integration.ElementHost elementHost = new MyElementHost();
            elementHost.Width = 150;
            elementHost.Height = 50;
            YCApp.TestUC tuc = new YCApp.TestUC(); // A WPF Usercontrol showing a button
            elementHost.Child = tuc;
            frm.Controls.Add(elementHost);
            frm.Show();
        }

The WPF UserControl shows fine.

The overridden WndProc is used (first message it gets is 129) but when closing my window the WM-Close message isnot encountered.

Whats wrong ?

Regards

   Winfried Wille

E.Mail: ww@w2ww.de

Viewing all 5157 articles
Browse latest View live


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