add-in

How to create excel add-in (excel 2003 or previous version) package with activeX dll?

醉酒当歌 提交于 2019-12-02 07:52:49
I am new to excel add-in prgramming and I am having a existing excel add-in project need to modify. The plug-in has 2 parts, one is programmed in VB and compiled into a ActiveX DLL file, the other part is inside the excel as an add-in. I already modified the source code of the DLL and recompiled a new DLL, but I don't know what is the correct way to re-package the 2 parts into one excel add-in package and give to my colleagues. I tried to remove the reference to old DLL from excel, but it seems I could not do that, it will always be there and I can't really remove it. This add-in is for excel

How to customize save behaviour in Word using VSTO

三世轮回 提交于 2019-12-02 05:27:17
Fundamental question on how to get the bits to work together: I've not used VSTO before and after 4 hrs of searching I've decided to ask! I want to create a simple AddIn for word that will execute when the user saves ANY document. I thought all I would need to do would be to create an AddIn in VisualStudio 2008, and put my code in the ThisAddIn class Public WithEvents objWordApp As Word.Application Private Sub objWordApp_DocumentBeforeSave(ByVal Doc As Word.Document, ByVal SaveAsUI As Boolean, ByVal Cancel As Boolean) MsgBox("my addin code is running") End Sub and that would be that. Only this

Turn off pretty listing in visual studio

会有一股神秘感。 提交于 2019-12-02 04:32:39
问题 I have a macro/addin where I need to disable the Vb.Net pretty listing temporary. Tried to record a macro but it only shows that I opened the options dialog. Also tried Dim props As EnvDTE.Properties = DTE.Properties("TextEditor", "Basic") but the props collection does not contain any of the options under VB Specific. (The options from General and Tabs are int the collection) 回答1: Found a listing of options here In my case it is Dim prettyListingProperty = DTE.Properties("TextEditor", "Basic

Adding a Menu to the Visual Studio Menu Bar within an Add-In

南楼画角 提交于 2019-12-02 03:51:20
问题 Is it possible to create an add a custom menu to the main menu bar in Visual Studio within an Add-In? I want the Add-In to create a company specific menu if it does not already exist and then add its own specific command to that menu. That way if multiple Add-Ins are supplied then they can all add the commands to the same menu. I have found an msdn link for a walkthrough in creating a VSPackage which does this but not from within an Add-In and it requires its own specific installation

Make hyperlink in MS Word Add-in

流过昼夜 提交于 2019-12-02 01:11:43
问题 is there any way to programmaticaly add an hyperlink to the selected text in a MS Word Add-In? Thanks in advance. 回答1: The code below converts selected text into a hyperlink which points to the Microsoft site: Microsoft.Office.Interop.Word.Range currentRange = Globals.ThisAddIn.Application.Selection.Range; if (currentRange != null) { Microsoft.Office.Interop.Word.Hyperlink hp = (Microsoft.Office.Interop.Word.Hyperlink) currentRange.Hyperlinks.Add(currentRange, "http://www.microsoft.com"); }

Adding a Menu to the Visual Studio Menu Bar within an Add-In

血红的双手。 提交于 2019-12-02 01:04:27
Is it possible to create an add a custom menu to the main menu bar in Visual Studio within an Add-In? I want the Add-In to create a company specific menu if it does not already exist and then add its own specific command to that menu. That way if multiple Add-Ins are supplied then they can all add the commands to the same menu. I have found an msdn link for a walkthrough in creating a VSPackage which does this but not from within an Add-In and it requires its own specific installation/registration. public static CommandBarControl GetCustomMenu(DTE2 applicationObject) { //Find the MenuBar

How to open file programmatically using EnvDTE in C#

两盒软妹~` 提交于 2019-12-02 00:12:33
问题 How to open file programmatically using EnvDTE in C#. 回答1: Assuming you have a hook to the correct DTE instance... DTE.ExecuteCommand("File.OpenFile", "c:\\derp.txt"); 回答2: You can try the following snippet directly in the Visual Studio Console: $DTE.ItemOperations.OpenFile("c:\derp.txt",$DTE.Constants.vsViewKindTextView) It should open the file as long as it exists... 来源: https://stackoverflow.com/questions/5039226/how-to-open-file-programmatically-using-envdte-in-c-sharp

How to intercept clicking of a built-in Office Ribbon control

做~自己de王妃 提交于 2019-12-01 23:46:45
I'm wondering if it's possible to detect when a user has clicked the Header/Footer button in Excel so I can show some custom header/footer related ribbon controls on my add-in's tab and hide them when the user is not in header/footer edit mode. Is it possible to hijack this button click somehow? I've seen applications hijack the Excel Save before. I'm looking for similar behavior just with the header/footer button. I'm using C#, Visual Studio 2012 and Excel 2010. I've created my custom ribbon using the Ribbon XML approach. One way I've discovered that worked was to use the <commands> section

Read the ActiveCell content in Excel using VSTO

耗尽温柔 提交于 2019-12-01 23:43:44
I'm trying to read the ActiveCell from within an Excel Add-in but not getting very far. Anyone any ideas? Excel.Window W = this.Application.ActiveWindow as Excel.Window; Excel.Range R = W.ActiveCell as Excel.Range; MessageBox.Show(R.Value2.ToString()); The Exception being thrown on the last line is: - Cannot obtain fields or call methods on the instance of type 'Microsoft.Office.Interop.Excel.Range' because it is a proxy to a remote object. I tried .Value, and it says: - Property, indexer, or event 'Value' is not supported by the language; try directly calling accessor methods 'Microsoft

How to open file programmatically using EnvDTE in C#

做~自己de王妃 提交于 2019-12-01 22:13:27
How to open file programmatically using EnvDTE in C#. Assuming you have a hook to the correct DTE instance... DTE.ExecuteCommand("File.OpenFile", "c:\\derp.txt"); You can try the following snippet directly in the Visual Studio Console: $DTE.ItemOperations.OpenFile("c:\derp.txt",$DTE.Constants.vsViewKindTextView) It should open the file as long as it exists... 来源: https://stackoverflow.com/questions/5039226/how-to-open-file-programmatically-using-envdte-in-c-sharp