vsto

VSTO Outlook ItemSend with C#

拈花ヽ惹草 提交于 2020-01-30 04:28:14
问题 I'm trying to add a string in the end of an Outlook email's body with VSTO private void ThisAddIn_Startup(object sender, System.EventArgs e) { this.Application.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } void Application_ItemSend(object Item, ref bool Cancel) { if (Item is Outlook.MailItem) { Outlook.MailItem mail = (Outlook.MailItem)Item; mail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML; mail

Access word checkboxlist and check if check mark in checkbox

随声附和 提交于 2020-01-26 04:02:45
问题 I have a button that creates checkedlistbox inside a table in word. the problem is that I can access the checkedlistbox only inside the function and if I am doing this inside the scope, I can only access the last checkedlistbox the code: { Microsoft.Office.Tools.Word.Controls.CheckedListBox listBox1; Document extendedDocument = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument); extendedDocument.Paragraphs[1].Range.InsertParagraphBefore(); listBox1 = extendedDocument

Set visibility of tab based on workbook file opened on ribbon VSTO Excel

喜欢而已 提交于 2020-01-26 03:57:08
问题 I have a VSTO application and in the MainRibbon.xml I am using the getVisible handler to identify whether the tab should be visible or not. The method setVisbility is called in MainRibbon.cs. I am trying to set the visibility of the tab to true if the filename/workbook openend is called "Template.xlsm". Otherwise I dont want to show the below tab. <?xml version="1.0" encoding="UTF-8"?> <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load" > <ribbon >

This method or property is not available because a document window is not active

五迷三道 提交于 2020-01-25 12:49:07
问题 I have a problem with adding content control's to document. I need add richtextcontentcontrol in specified range to paragraph in document, but no to activedocument, to document witch i open from path. Word.Range range = paragraph.Range; range.SetRange(1, 3); try { var richTextControl2 = document.Controls.AddRichTextContentControl(range, "richTextControl" + counter); richTextControl2.PlaceholderText = "Enter your first name"; } catch(COMException e) { Debug.WriteLine("Error :" + e); } document

ClickOnce Setup instantly stops executing

这一生的挚爱 提交于 2020-01-25 10:58:07
问题 I've got a problem with a ClickOnce Setup and have absolutely no idea what I'm doing wrong... I'm trying to publish a VSTO AddIn for Outlook 2013 using VS2012. However when I click on the Setup.exe created by the ClickOnce Publish the Setup shows the small installation window for about half a second and then instantly disappears again. This without showing any error message or generating any event log entries at all. The ClickOnce manifest is signed with a test certificate (self-signed

When Microsoft Access is shutting down, how can I catch the current properties of a CustomTaskPane before the controls are disposed..?

巧了我就是萌 提交于 2020-01-25 07:26:08
问题 I've created a VSTO addin for Microsoft Access by following the directions by Microsoft guru Andrew Whitechapel here, and it's working nicely. But the addin has a CustomTaskPane, and I'm having an issue with it when Access is closing. If the CustomTaskPane is open when Access closes, the addin should save the properties of the CustomTaskPane controls. If code for this is placed in ThisAddIn_Shutdown() , I receive the following error: System.ObjectDisposedException: Cannot access a disposed

Get Excel macros names with descriptions

心已入冬 提交于 2020-01-25 05:16:44
问题 I have found many ways for getting macro names from Excel using automation (example). They are mostly the same and neither can 1) retrieve macro descriptions (each recorded macro can be decorated with a description using Excel UI) or 2) filter out ordinary VBA functions (there are Excel recorded macros and there are funcs/macros that you an write yourself). It seems as if Excel is keeping descriptions as comments in the source code but also in some private place too. If one deletes code

Setting CurrentCulture in VSTO Addin

こ雲淡風輕ζ 提交于 2020-01-25 00:04:17
问题 I am creating a VSTO addin for Excel 2007. All works fine on my development computer with English(UK) regional settings. However some end users will have other settings. All works fine when adding information to the database, however when I try and fill a datatable with English(US) regional settings it fails. Dim TA As New DB_InquiriesTableAdapters.qry_InquiriesTableAdapter Dim DB As New DB_Inquiries.qry_InquiriesDataTable TA.Fill(DB) 'FAILS HERE as date format is incorrect for regional

What is the difference between Office Automation, VSTO, and Open XML SDK?

久未见 提交于 2020-01-24 03:52:25
问题 What is the difference between Office Automation, VSTO, and Open XML SDK? Do we need all of them or some of them are obsolete? 回答1: Office Automation refers to the manipulation of an Office program (or, more commonly, an Office document via an Office program) programmatically, using COM interop. Visual Studio Tools for Office (VSTO) is a set of development tools available in the form of a Visual Studio add-in (project templates) and a runtime that allows Microsoft Office 2003 and later

c# excel beforesave thread

你说的曾经没有我的故事 提交于 2020-01-23 17:42:08
问题 I try to create a c# excel 2007 Add-In, and i want to do "faster" the "beforeSave" method. I simply use a thread (and try the task and task.factory too) but its always say same error. The code. private void ThisAddIn_Startup(object sender, System.EventArgs e) { this.Application.WorkbookBeforeSave += new Microsoft.Office.Interop.Excel.AppEvents_WorkbookBeforeSaveEventHandler(Application_WorkbookBeforeSave); }// thisAddIn_startup method end public void Application_WorkbookBeforeSave(Microsoft