FAQ Database Discussion Community


Fine Grained Cell Coloring with Excel and .NET

c#,excel,vsto
Microsoft provides a .NET API to programatically set cell colors Excel.Range rng2 = this.Application.get_Range("A1"); rng2.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); Is there a way to have two different colors within the ...

How do you find the next available time when creating an Appointment using C# VSTO

c#,vsto,outlook-addin
I've written the following code in C# to create a new appointment with 1 attendee (and me). But the start time isn't automatically defaulted to the next available free time. AppointmentItem newAppointment = Globals.ThisAddIn.Application.CreateItem(OlItemType.olAppointmentItem); newAppointment.MeetingStatus = OlMeetingStatus.olMeeting; Recipients recipients = newAppointment.Recipients; Recipient readyByRecipient = null; readyByRecipient = recipients.Add(emailAddress); readyByRecipient.Type =...

How to get CustomDocumentProperties using Excel Interop?

c#,excel,interop,vsto
The below code is used to get the custom document properties for Excel workbook. var xlApp = Globals.ThisAddIn.Application; // This works in VSTO Excel Add-in var xlApp = new global::Microsoft.Office.Interop.Excel.Application(); // This doesn't work anywhere xlApp.Visible = true; global::Microsoft.Office.Interop.Excel.Workbook workbook = xlApp.Workbooks.Open(file, false, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,...

MS Word document not visible when opening programmatically through interop

c#,ms-word,vsto,office-interop,word-interop
The following code opens the document in the background but not make it visible even though I am using Visible = true and oDoc.Activate(); using Word = Microsoft.Office.Interop.Word; Word.Application oApp = new Word.Application(); Word.Document oDoc = oApp.Documents.Open(FileName: @"C:\Folder1\Test1.docx", Visible: true); oDoc.Activate(); According to this SO post, it should have worked....

Error: The specified value is out of range in C# power point

c#,vsto,powerpoint
I am trying to calibrify the text in entire presentation but if i have some ppt that is already designed my first slide consists of almost 37 shapees . so when i calibrify some shapen it gives an error saying " the specified value is out of range" Below is...

VSTO Outlook Addin Email Sender Name

c#,vsto,outlook-addin
I have a VSTO Outlook 2013 addin that reads properties from CurrentItem when the read mail window is open. When I get the property Sender I always get system.__comobject Why does it keep returning this?

VSTO Addin Form Closing Handler

c#,forms,vsto,outlook-addin
I have a VSTO addin for outlook 2013. I'm trying to register an event with an event handler for a Form closing event. Here is my code from class Form1: public delegate void MyEventHandler(); private event MyEventHandler Closing; private void OtherInitialize() { this.Closing += new MyEventHandler(this.Form1_Closing); } Also from class...

VSTO Outlook Addin Ribbon Group Not Showing on Ribbon

c#,outlook,vsto,outlook-addin
I have an Outlook Addin That Adds a Group to the Ribbon with two buttons. It was working perfectly before I added the second button, but they have the same properties just different click handlers. It shows up in the correct place in the customize ribbon menu, but it is...

MailItem SaveAs() Method FIletypes

c#,vsto,outlook-addin,office-addins
When I pass olMHTML it saves it with .msg extension, but if I change the extension to .mht it works as an mht file perfectly and if I don't I have trouble opening the file with .msg extension. If I save it as olMSGUnicode, it saves with no extension but...

How to create a dialog for use by an Excel AddIn?

c#,excel,user-interface,vsto
I am familiar with the basics of Excel AddIns, but have no idea how to design, implement and later display an internal dialog. See standing question with images here: https://social.msdn.microsoft.com/Forums/en-US/935ebeae-1b88-4609-ba33-b0e522d2797f/how-to-create-a-dialog-for-use-by-an-excel-addin?forum=exceldev TIA Notes: (1) My programming language is C# (2) I prefer to design dialogs by drawing them....

Document.Fields.Update event in Word 2010 C#

c#,vsto,word-2010
I have an application level addin for Word 2010 written in C#. I would like to incorporate some document variables. I have no problem updating docvariables with data and calling a Fields.Update. I also have no problem with assigning a method to update all the document variables explicitly. What I...

Save File Dialog in Outlook VSTO Addin

c#,outlook,vsto,outlook-addin
I want to create a save file dialog that opens when you press a custom ribbon button and has the filename and initialdirectory properties set to certain values. Right now I create that dialog within a form. In the designer it shows in the bottom pane as it is not...

ClickOnce VSTO solution signed with mage.exe - certificate not trusted error

deployment,certificate,vsto,clickonce,mage
I'm trying to deploy a VSTO solution, which are 2 addins for Word and for Outlook, using ClickOnce. Due to our deployment infrastructure/practices, I cannot publish it using Visual Studio, it is instead built on a build server and deployed via a deployment server. For local development, a self-signed certificate...

VSTO: manipulating COM objects (“one dot good, two dots bad”)

c#,excel,vba,com,vsto
Coming from an Excel VBA background I would frequently write code such as: Range("myRange").Offset(0, 1).Resize(1, ccData).EntireColumn.Delete I'm now moving to VSTO, and have been reading about RCW counters, etc., and the need to explicitly release COM objects. The basic advice seems to be: don't chain together references to Excel objects...

Correct Way to Shutdown an Addin While Outllook Still Runs

c#,vsto,outlook-addin
I have an outlook addin I'm writing in VSTO. I want to exit the addin in a certain case. System.Application.Windows.Forms.Exit() exits outlook completely. I just want the addin to shutdown. I can't call ThisAddIn_Shutdown() because it is private. What is the correct practice to shut the addin down? This addin...

How to add images from resources folder as attachment and embed into outlook mail body in C#

c#,vsto,outlook-addin,outlook-2013
I have a couple of images stored in visual studio project Resources folder, and I have to load them and display on the outlook mail body. Here it is the code: Bitmap b = new Bitmap(Properties.Resources.MyImage); ImageConverter ic = new ImageConverter(); Byte[] ba = (Byte[])ic.ConvertTo(b, typeof(Byte[])); MemoryStream logo = new...

VSTO Addin Save File Dialog

c#,vsto,outlook-addin
I have a VSTO addin that has a form with a saveFileDialog on it. I want to pass a specific filename and path to saveFileDialog to set the properties FileName and InitialDirectory. The problem is the only way I can see to do it is to modify InitializeComponent() and the...

Is it possible to develop VSTO addins for Office 2007/2010 with Visual Studio 2013?

ms-office,vsto,add-in
Is it possible to develop VSTO addins for Office 2007/2010 with Visual Studio 2013 ? Seeing only VSTO addins targeting Office 2013 by default in Visual Studio 2013.

Outlook 2013 VSTO: How to get original MeetingItem for an Appointment?

outlook,vsto
I am working on an Add-in and as part of my work, I need to be able to Accept a meeting request. I need to be able to do this from both the Mail tab when a MeetingItem is selected in the Inbox, and from the Calendar tab when an...

How can I create a style with borders from VSTO code?

c#,excel,vsto
I am developing an Excel addin in C#, using VSTO. In this addin, I create some styles and add them to the current workbook. Everything works fine until I try to set some borders on my style. This is the code I use: var style = workbook.styles.Add("My style"); style.IncludeAlignment =...

Replace text in MailItem Body

c#,vsto,outlook-addin
I've added a ribbon button in the Outlook Explorer, that creates a new email from the selected email when clicked. This works fine using the MailItem.Copy method. But I also need to replace some text in the message body with a different value. The problem is the email could be...

Change Excel Comment Font in C# VSTO

c#,excel,comments,vsto
This may seem really trivial, but for the life of me I cant figure out how to alter the font properties of a comment box. Excample of VBA code would be: Sub SetCommentsProperties() Dim Cell As Range For Each Cell In Selection If Not Cell.Comment Is Nothing Then With Cell.Comment.Shape.TextFrame.Characters.Font...

Excel Find Cell Name

c#,excel,winforms,vsto
I am trying to write a simple method to find whether the activecell has a namedrange if so, what is it. But it isnt going too well. Here is my code: private void btnH4_Click(object sender, EventArgs e) { if (Globals.ThisWorkbook.Application.ActiveCell.Name == null) { MessageBox.Show("Nothing"); return; } MessageBox.Show(Globals.ThisWorkbook.Application.ActiveCell.Name.ToString()); } ...

Getting Outlook Window from VSTO Addin

c#,outlook,vsto
I have an Outlook 2013 VSTO addin. I want to center my saveFileDialog I create. TO do this you need to pass it a Window object of the parent. I'm not sure if IWin32Window and Window are the same, but here's what I have. public IWin32Window getWindowHandle() { dynamic activeWindow...

Publishing VSTO add-in using MSBuild gives error: The “SignFile” task failed unexpectedly. System.ArgumentNullException: Value cannot be null

c#,visual-studio-2013,msbuild,vsto,teamcity
I am trying to publish a VSTO add-in for Word using MSBuild on a TeamCity build server without Visual Studio. I've done the stuff from these two blog posts: http://kentb.blogspot.com/2008/08/building-vsto-projects-without-visual.html http://www.wiktorzychla.com/2011/02/msb3147-could-not-find-required-file-on.html My build file is my Visual Studio solution and my target is "publish". ClickOnce publishing in Visual Studio 2013...

VSTO Addin Connecting to MSSQL

c#,sql-server,vsto
I have a VSTO addin. Right now I am hard coding two dictionaries for development. They need to persist so I am going to use mssql. I have created the tables and all, so everything is done on that end. But I'm having some trouble getting a few things to...

C# Excel VSTO: Difference between get_Range() and Range()

c#,excel,vsto
I am trying to understand the difference between Worksheet.Range() and Worksheet.get_Range(). Take the two lines of codes below: Globals.ThisWorkbook.Worksheets["Sheet1"].Range("A4").Value2 = "test"; This will print "test" on cell A4 on worksheet labelled "Sheet1". Similarly, Globals.ThisWorkbook.Worksheets["Sheet1"].get_Range("A4").Value2 = "test"; should produce the same result, instead I got: 'System.__ComObject' does not contain a definition...

Word Add-in keeps Word process alive when document is embedded via OLE

c#,com,ms-word,vsto,ole
I have built a Word Add-in which has to do a task when the user closes the document. I installed an event handler for the DocumentBeforeClose event of the Application object to do that. The problem is that the event handler appears to prevent the Word process from exiting when...

prevent App.Config compiled into the dll VSTO (C# \ .Net)

c#,.net,vsto,configurationmanager
I checked prior posts like How do I prevent the app.config from being integrated into a .net Library (dll) but these did not help me with my situation. I am having trouble keeping my Outlook addin app.config not compiled into the dll. I assume it's being compiled, as when it...

DateDifference in C#

c#,vsto,ms-project
Using VBA for MS Project, one of the command is DateDifference. differencedate = Application.DateDifference(tsk.BaselineStart, tsk.BaselineFinish, ActiveProject.Calendar) However, I am trying to use VSTO for MS Project, but I can figure out how to use DateDifference. Is there an equivalent command cor C#?...

Outlook 2013 VSTO: Determine which calendar an AppointmentItem is on?

outlook,vsto
In Outlook 2013 in Calendar view, when an AppointmentItem is selected, I need to be able to determine if that item is on the current user's Calendar, or if they have selected an item from someone else's shared calendar. So if John Doe is the current user, I need to...

How to check if a COM object still exists

.net,com,ms-office,vsto
I basically understand how managed RCW objects wrap COM objects in .NET. My question is what happens when the COM object ceases to exist. I know that the RCW object increases the reference count so the COM object should not be released as long as the RCW object is alive....

VSTO Outlook Addin Dialog Boxes

c#,wpf,vsto,outlook-addin,office-addins
I've been trying to figure out the correct way to pop up a dialog box in a way similar to MessageBox.Show in my VSTO addin. I read this could be achieved using WPF, but is there a better way? I've found many different examples most of which are in VBA,...

VSTO C# Word Template Publishing No Installation

c#,visual-studio,visual-studio-2012,vsto
I'm a newbie here and a newbie in VSTO. I've created a VSTO Word Template using C# and I want to get the final template file (with code functions) to give to my boss without installing anything. Is this even possibly? If yes... HOW? Hope you guys could help me!...

COM Interop RCW Reference Count for an Excel Range Object

c#,excel,vsto,com-interop
As far as I'm aware, in COM Interop if we cross the .NET/COM boundary we get an increment in the RCW internal counter. So I created a VSTO Excel workbook (2013) app and ran the code: private void RCWWorkbooks() { Excel.Workbooks wbs = Application.Workbooks;Excel.Workbook book1 = wbs[1]; Excel.Workbook book2 =...

VSTO document-level customization Intercept Commands

c#,ms-word,vsto
We are currently bulding a set of corporate templates using C# VSTO document-level customizations. We need to intercept the Paste command and change the content before it is pasted into the document. For example if a users is pasting an image we would also insert a caption with it, or...

How to add a ribbon group to both Outlook inspector windows and the inline response contextual menu?

c#,outlook,vsto,outlook-addin,ribbonx
I want to add the same controls to the ribbon whenever an email is being composed, regardless of whether the email is popped out in an inspector or in an inline response. I can do this by duplicating the same XML in two places, of course, like this: <customUI onLoad="Ribbon_Load"...

VSTO Outlook 2013 Addin Quit

c#,dialog,vsto,outlook-addin
I have a VSTO addin that displays a a dialog box with buttons yes no and cancel. I want the form to close anytime cancel or the X are clicked. I also want the application to quit when the form is closed. Here is my code: var frm = new...

Cannot perform runtime binding on a null reference - Empty Excel Cells

c#,.net,excel,vsto
I cannot seem to think of a way to correct the error mentioned in the title and was looking for some ideas on what should be done. I am trying to read the rows of a excel spreadsheet into an object. The first time it loops I have no problems...

VSTO Outlook Getting Email Address From Someone with same Domain

c#,vsto,outlook-addin
In VSTO outlook 2013 addin I use this method to get the email address of the sender: Inspector currentObject = Globals.ThisAddIn.Application.ActiveInspector(); Object currentItem = currentObject.CurrentItem; MailItem message = currentItem as MailItem; string senderMailAddress = message.SenderEmailAddress; This always works great except in one case. I get a string that is their...

C# How to Determine if Netwokr Path Exists w/o new Process

c#,vsto
I want to check if a certain network drive is accessible and exit my addin if not. It's an Outlook 2013 addin in VSTO. Anyway, I would like to search for it by UNC if possible as \192.168.0.2\WAN\ or I could use the drive letter as a last last resort,...

C# VSTO Outlook 2013 - Explorer Close handle Save Event

c#,outlook,vsto,add-in
I have a RibbonBar with some Buttons that appears in the Outlook Explorer (Double Click on a mail). Some progresses in the background edit the attachments of the mail. If the user close the Explorer, outlook will ask to save the edited mail (save the changes). is there a Event...

Cells format event/hook

c#,excel,vsto
I worked on VSTO C# Excel 2013. I tried and searched many approaches to find a way to trigger more events. One of the important events I need is, cells formatted event (changing background color, merging cells. Is there any way?...

Outlook 2013 Add-in Tutorial for beginners

c#,outlook,vsto,add-in
I have spent the better part of a day piecing together bits of information on how to get into the Object model of developing Add-ins, and only found marginal coverage of the fundamentals, none of which goes into any real detail about the core functionality. I am attempting to develop...

specify VSTOLocal string for Manifest registry entry in VSTO Addin deployment using Clickonce

excel,vsto,clickonce
I have developed a VSTO Excel Application level Addin that gets installed by Clickonce installer. I always want the Addin to use the VSTO file that is available in the installation location rather than using from the clickonce cache. This can be achieved by appending the value "|VSTOLocal" to Manifest...

MailItem user property of type olDateTime showing by default 12/30/1899 value. How can we show empty instead?

c#,vsto,outlook-addin,office-addins
I have created a user property on mailitem called "DueDate" i am setting default value null for this user property but when change the view in outlook & add the DueDate custom column on default view, it is showing "12/30/1899" value. var prop = mailItemObject.UserProperties.Add("DueDate", Outlook.OlUserPropertyType.olDateTime, null, null); prop.Value =...

How to open an excel file from VSTO plugin and get VSTO workbook?

c#,vsto,import-from-excel
I already know how to open file and get Workbook from Microsoft.Office.Interop.Excel namespace. But is there a way to get Workbook from Microsoft.Office.Tools.Excel namespace? Casting between the two does not work. I know this sound simple, but I'm stuck - all answers on SO point to Interop solutions.

Is Folder.PropertyAccessor safe to call from managed code?

c#,.net,outlook,vsto,outlook-addin
We recently finished development of a VSTO Outlook add-in. For some configuration data, it uses custom olText properties on a Folder. When our add-in detects that these properties are not available, it uses the UserDefinedProperties property of the Folder to Find/Add our custom properties if they don't exist. if (folder.UserDefinedProperties.Find(propertyName)...

C# Access Data in VSTO Addin

c#,vsto,outlook-addin
I'm creating a VSTO addin. I want to create a dictionary once as outlook starts that I can then access from methods within the OutlookRibbon class. What is the best practice or proper method to create such a dictionary? I currently have the method where the dictionary is created in...

Word 2013 activate “New” screen from VSTO

vb.net,ms-word,vsto,office-2013,word-addins
I'm developing a Word AddIn, and I've run into a bit of a problem. I need to modify the BuiltIn BuildingBlocks, and to do that, I need an active document. Since Word 2013 no longer starts with an open document, but instead shows the "New (Latest)" screen, my AddIn creates...

Get Array of Values for Non-Contiguous Range

c#,excel,vsto
I'd like to be able to get an array of values for just the visible cells on a worksheet. However, the Range.Value2 property only seems to work with contiguous cells. What would be an efficient method of getting the visible cell values into a multiple dimensional array? Perhaps we could...

Excel CustomTaskPane with WebBrowser control - keyboard/focus issues

c#,excel,winforms,excel-2010,vsto
I am having this exact issue https://social.msdn.microsoft.com/Forums/vstudio/en-US/e417e686-032c-4324-b778-fef66c7687cd/excel-customtaskpane-with-webbrowser-control-keyboardfocus-issues?forum=vsto Also mentioned here https://connect.microsoft.com/VisualStudio/feedback/details/521465/the-focus-issue-between-excel-cells-and-excel-customtaskpane-with-webbrowser-control I am writing an Excel 2010 plugin using Visual Studio Professional 2013. I've created a simple CustomTaskPane with a System.Windows.Forms.WebBrowser child filing...

Outlook AddIn `PropertyPage` not showing up in Outlook Options

.net,vsto,outlook-addin
I have an Outlook 2007 Add-In project which I'm trying to add a PropertyPage to. I've implemented a OptionsPage class (which implements PropertyPage) which is added during the Application.OptionsPagesAdd event. Public Class OptionsPage Implements Microsoft.Office.Interop.Outlook.PropertyPage Private Sub Me_Load(sender As Object, e As System.EventArgs) Handles Me.Load System.Windows.Forms.MessageBox.Show("Test Options Loaded") End Sub...

VSTO Outlook add-in, does UI manipulation need to be done from main thread?

multithreading,outlook,ms-office,vsto,add-in
I'm maintaining a VSTO add-in for Outlook, and it has a BackgroundWorker that handles syncing with a server. I want the worker to trigger user errors in the UI (changing the picture on a button, enabling a message in a settings window). Does UI manipulation need to be done from...

Excel DNA how to get events for each minor change in spreadsheet?

c#,excel,vsto,excel-dna
Developing excel spreadsheet real-time sharing application I got stuck on how to get events for border change, colour change,multi cell editing etc...(used VSTO but problem still sustain...) I tried Excel DNA for to make RTD server to get real time data to excel but how to send changes in sheet...

How to Expose Listbox in UserControl in CustomTaskPane VSTO C#

c#,ms-word,vsto
I am creating an application level add-in for Word 2010 using C# VSTO. I created a User Control, placed controls within it, and then used the User Control to add a Custom Task Pane: UserControl myUserControl; myUserControl = new PageElementsPane(); mytaskPane = this.CustomTaskPanes.Add (myUserControl, "Page Elements", doc.ActiveWindow); So far so...

How can I reliably get the object of a contact context menu in an Outlook 2013 addin?

c#,vsto,outlook-addin,outlook-2013
I am adding an entry to the context menu for a Contact in Outlook 2013 following the example in this article. Here is the XML: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"> <contextMenus> <contextMenu idMso="ContextMenuContactItem"> <button id="MyContextMenuContactItem" label="Do something..." onAction="OnDoSomething" insertAfterMso="DialMenu"/> </contextMenu> </contextMenus> </customUI> The entry shows up in the menu properly, and when...

The customization cannot be run because the solution ID in the document does not match

visual-studio-2010,vsto
I have developed a VSTO solution for Excel 2010 in VS 2010. The target framework is .NET 3.5. The solution works fine if I have all the components (dll, vsto and manifest and the Excel file) in one folder. I open the Excel file and the add-ins loads perfectly well....

Will VSTO Work With Microsoft Office for Mac 2015

.net,visual-studio,ms-office,vsto,office-interop
With .NET coming to the Mac, I see no reason why support for VSTO (and therefore the ability to write cross platform office ad-ins) couldn't come with it. Have there been any announcements to this effect either way? I'm almost certain that they'll support their office web app platform, but...

How to get rowspan and cospan of word document table using openXML

c#,vsto,openxml,openxml-sdk
i m very new to openXML, i m trying to get the colspan and rowspan value of the table in wordprocessingML. can any one explain how can i get these two values using openXML Thanks in advance...

Copy Worksheet Excel VSTO C#

c#,excel,vsto
I'm trying to copy a worksheet from an existing Excel file to my current workbook. I have an Excel Add-in with the following code: string wsName = "template." + ((System.Windows.Forms.Button)sender).Tag + "." + ((System.Windows.Forms.Button)sender).Text; Microsoft.Office.Interop.Excel.Application x = new Microsoft.Office.Interop.Excel.Application(); x.Visible = false; x.ScreenUpdating = false; x.Workbooks.Open(Properties.Settings.Default.TemplatePath); try { foreach (Worksheet...

Issues reading unread mails in Outlook

c#,.net,outlook,vsto
I am trying to develop an add-in for Outlook. In that I want remove attachment when a new mail is received. So I call my function on the NewMailEx event. It is working fine. In that function I try to find unread mails in the Outlook inbox. From those I...

Deploying VSTO Addin with Windows Installer

c#,vsto,outlook-addin,office-addins
I found the documentation here: https://msdn.microsoft.com/en-us/library/cc442767.aspx But in my solution I do not have a OfficeAddInSetup project so I assume I am to add a second project with installshield to achieve this, but in the docs it references VSTO 2010 redistributable. I am using 2013. Are the directions any different...

Debug Excel VSTO add-in when launched by double-clicking existing file

excel,debugging,visual-studio-2013,vsto
I have a bug in an Excel VSTO 4.0 C# add-in that I've developed but it is only occurring when double-clicking on an existing file to launch Excel. I'm trying to figure out a way to start the VS2013 debugger so that I can put in some breakpoints but none...

How can I disable Word's built-in Ribbon Tabs when a specific document is loaded?

c#,ms-word,vsto
I am using the following code right now: <?xml version="1.0" encoding="UTF-8"?> <customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <commands> <command idMso="Font" enabled="false"/> <command idMso="AlignLeft" enabled="false"/> <command idMso="AlignCenter" enabled="false"/> <command idMso="AlignRight" enabled="false"/> </commands> and so on, but this completely disables the buttons obviously. I now want to restrict my users from being able to use...

Copy/Paste a listobject in excel lose the attached events

c#,vsto
Let's create a ListObject and attach an event on it as msdn explain here: https://msdn.microsoft.com/en-us/library/eyfs6478.aspx The code In an application-level addin, code will look like above: Worksheet worksheet = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); Excel.Range cell = worksheet.Range["$A$1:$D$4"]; ListObject list1 = worksheet.Controls.AddListObject(cell, "list1"); list1.Selected += list1_SelectedDeselected; list1.Deselected += list1_SelectedDeselected; With something like that to...

Add Change Event Handler to New Excel Sheet

c#,excel,vsto
How do I add a change event handler to a newly inserted sheet? Basically, I have a button that copies a hidden template sheet and insert it as a new sheet. However, the event handler does not copy.

How to close instance created by adding doc.InlineShapes.AddOLEObject

c#,.net,vsto,office-addins
I am inserting a word document into a word document by doc.InlineShapes.AddOLEObject. doc.InlineShapes.AddOLEObject(System.Type.Missing, filename, true, false, System.Type.Missing, System.Type.Missing, System.Type.Missing, range); It inserts the embedded document,but after closing the main word file, WINWORD.EXE process still running. How to solve this problem.. can anyone please help me?...

C# VSTO Addin Exception With CurrentItem

c#,vsto,outlook-addin
When trying to obtain the current item with focus in an outlook 2013 addin I get this exception: An exception of type 'System.MissingMemberException' occurred in System.Dynamic.dll but was not handled in user code Additional information: Error while invoking [PROPERTYGET, DISPID(0)]. The code throwing the exception is this: Inspector curObj =...

Outlook Addin, When Loading Error Ribbon_GetDCVisible

c#,outlook,vsto,outlook-addin
I have an outlook VSTO addin, I get the error Ribbon_GetDCVisible Exception occurred while calling the function GetVisisble when it loads. Yhe stack trace shows my last function called is the ThisAddIn_StartUp() handler and it is e mpty. Any ideas? EDIT: I just made a blank outlook 2013 addin and...

change the Label of a button in ribbon word add in

vsto,ribbon,office-addins
I'm trying to create a simple Word add-in. I the Ribbon a have create a button and I want to change its label depending on the type of word document. the document is a mail merge that has two types of models: Demand and Response. I want to have button...

VSTO - How to make Ribbon buttons to fill vertically the blank space

excel,button,vsto,ribbon,fill
I'm building a VSTO excel application, using Visual Studio 2013. I have one Large sized Ribbon button in one column, next to two Regular sized in another column. What I want is to fill the vertical space in the regular buttons column equally. To see an example of what I...

How to run a method in a VSTO Word Template from a separate .NET application?

.net,vba,templates,ms-word,vsto
I'm working on a project that involves migrating macros in a Word Template to VB.NET making use of VSTO. We've been able to create the Word Template and migrate the code to VB.NET just fine, however we need to action a certain VSTO method from a separate .NET application. Previously,...

Outlook 2010 - how to receive attachment events when mail item is created from Word or Excel

ms-office,vsto,outlook-addin
I have an Outlook 2010 plugin using VSTO that converts attachments before they are added to mail items. The way I accomplish this is to register for new inspector events in the plugin startup inspectors = Application.Inspectors; inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OnNewInspector); then in the new inspector event handler, check for...

Dyncamically change ribbon button image in Excel ( C#, XML)

c#,xml,button,vsto,ribbon
I made a customized XML ribbon for Excel in Visual Studio. The thing is that I want to change the ribbon-button images dynamically. Either when a certain cell value has been changed the image is supposed to change or if a timer ticks. My problem is that i can't find...

Simplest way to support logging from a VSTO AddIn

c#,logging,vsto
I have written a simple MS Word AddIn in Visual Studio 2013, and I would like to be able to log events, preferbly to the Windows Event Viewer. It seems that I will run into permission issues if I try to create a new event source for my application. I...

Get result of ShowCategoriesDialog in Outlook

c#,outlook,vsto,outlook-addin
In my code I open categorize dialog like this: item.ShowCategoriesDialog(); Is it possible to determine whether user clicked "OK" or "Cancel" in the dialog? Currently I compare item's categories before and after showing the dialog, but maybe there is a better way....

C# Outlook 2013 Addin Accessing Explorer

c#,vsto,outlook-addin,explorer
Is it possible to access Explorer to check for the existence of certain folders, and create folders if necessary from an outlook addin? If so what API/interface is used to do so from outlook. The MAPIFolder seems to be just for the outlook folders. Thanks in advance EDIT: To clarify,...

Outlook Addin Updating - Replacing DLL sufficient?

vsto,outlook-addin
Working on an outlook addin and I was wondering if manually replacing the compiled DLL on a target machine is sufficient when I decide to update my addin ? is that practice even valid for stability ? on some minor changes i did to my addin for tests, It seemed...

How to create an appointment using C# VSTO and display the Schedule Assistant view

c#,vsto,outlook-addin
I want to add C# code (in my Outlook VSTO Addin) to create an appointment and show the Schedule Assistant view when it's displayed. Below is the code I've written so far which creates an appointment, adds the recipient. But when the Display method is called, its displayed showing the...

Retain the source template when saving slides in ppt

c#,vsto,office-interop
I am trying to save selected slide so it doesnt retain my source template. how do i retain the existing template while i save the slides private void SaveSelectedSlide_Click(object sender, RibbonControlEventArgs e) { try { PowerPoint.Application ppApp = Globals.ThisAddIn.Application; PowerPoint.SlideRange ppslr = ppApp.ActiveWindow.Selection.SlideRange; string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var temporaryPresentation =...

Application.CreateItem and default store VSTO Outlook 2010-2013

outlook,vsto,outlook-addin
I am working on an Outlook VSTO addin (.NET4.0 targeting Office 2010/2013). It looks like the only way to create an item (e.g. a contact) is to use CreateItem on the Application object Globals.ThisAddIn.Application.CreateItem(OlItemType.olContactItem) as ContactItem Therefore the created item will live in Outlook's default store (see picture). Is there...

Unit Testing VSTO projects

c#,unit-testing,vsto
In most unit test tutorials I follow it has me create a second unit test project and then add a solution/project reference from the test project to the other project. I have a VSTO addin, and when I go to add the reference I don't see anything listed under Solution...

Format too old or invalid type library in Chinese Excel 2010

c#,ms-office,vsto
Error came at Startup of Excel 2010 in Chinese MS Office . Error is as followS 格式太旧或类型程序库无效 . (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD) ) Please Assist ? ...

Searching user tasks by task.body text

c#,visual-studio-2013,vsto,outlook-addin
Good morning all! I have spent a good bit of time searching and reading forums about this, but I can't seem to find a solution. Any help you all can offer is greatly appreciated. I have created an Outlook Add-In via C# and Visual Studio 2013. This add-in will create...