How to create vb app as a Microsoft Word right-click menu option - vb.net

I am trying to make a Windows Form application using Visual Studio in which I right click on a word document, select an item 'pages count' from the right-click menu, and a form will pop up with the number of pages in that document.
Am I right to be using Visual Studio for this?
How do I call "thisDocument" or "activeDocument", and make the document the one that is selected in the menu, if the document is not actually open?
I saw that for application.ThisWorkbook, if it the application is an add-in, it will bring up the application calling it, but I am not quite sure if an add-in is part of Visual Studio?
https://msdn.microsoft.com/en-us/library/office/ff193227.aspx
I hope this question isn't too basic -- all these things sound so similar to me, I'm having trouble sorting it all out with googling and reading questions.
Thanks for any clarification!

Related

Open Relink dialog via button

I am new to MS Access 2016 and came across a supposedly minor issue but I couldn't figure it out yet.
I'd like to use a button on a form which opens the dialog "Relink Lists to New Site". The relinking will be done manually but opening it should happen by a button-click.
The manual way to open it would be:
right-click on any table
More Options
Relink Lists...
I thought of some vba code or a macro to connect to the button.
Does anyone know if this is actually possible and if yes, any hints?
I'd appreciate any hints.
Since this button can also be found in the ribbon, you can use the idMso to invoke it:
Application.CommandBars.ExecuteMso "AccessRelinkLists"
You can find a listing of all idMso identifiers used in Office 2016 here: https://www.microsoft.com/en-us/download/details.aspx?id=50745. This contains an Excel file for each Office program with a listing of all possible controls and their identifiers.
Note that this button is context-dependent, and if you invoke it in a context where it's unavailable (e.g. an Access database without SharePoint lists) it will error.

How to find a form from many forms in vb6 on a existing project

I am working on a old project of vb6 which has hundreds if forms. I am able to run the application and have to fix a runtime error in a form which pop up. I don't know the name of the form and only have visual reference. I tried using debug but It has continues SQL statements running in a loop. Any advice is appreciated.
Thanks.
Search the code for the form caption, or the labels of controls on the form, using visual studio's "find in files" or simlar function of your favourite editor.
If the caption is set in the form design, this will take you to the .frm file the form is stored in. You can open this in Notepad or another editor to get the name of the class (which is usually the same as the filename).
If the caption is set in code, you can place a breakpoint on that line. Again, this will lead you to the code which instantiates the form.

Is there a way to locate a code block from a GUI in debug mode?

I'm digging through a program that contains a lot of forms with names that aren't as descriptive as I'd like them to be. I am trying to edit some motor control functions, and in the GUI I am able to reach the form that contains buttons controlling the motor, but I'm not sure where the code is that controls this form. Is there a way to open up the code block corresponding to the form I navigate to from the GUI in debug mode?
Or, alternatively, how can I navigate through the GUI without running it? I know I can right click and do "View Code", so if I could navigate to the form I'd be able to that.
I am using VB.NET in Visual Studio 2010
Go by button text. In visual studio search(Ctrl+F) using the text, visual studio will find the designer.vb file holding the button with the text, once it is done try to look at the design of particular then you can figure out which form you need to look at.
thanks

Embedding Word Object into VB.Net Winform

I wondering if its possible to use Microsoft Word as a text editor in a VB.Net project?
My project currently uses a Rich Text Box to allow the user to right a report which is then saved and a report generated. I was wondering if i could switch to Word for better formatting and layout options, be it embedded in the actual form or in another form thats called (if that makes it easier to assign the control).
I have worked on opening Word itself via a button click but would like to have it incorporated in the project. All users that would actually use the program would have one of the more recent versions of word installed.
Any pointers to websites would be great as i'm constantly searching but not getting very far
Thanks

How to implement Custom Ribbon resizing in Excel 2007?

I'm working in a ribbon project for Excel 2007, using Visual Studio 2008 and VSTO, I'm trying to make my ribbon's groups collapse into galleries when I resize the Excel window, this is a functionality that the other tabs in the ribbon have (the tabs that come with Excel).
At first, I thought this wouldn't be that much difficult, I imagine that it would be like a property from the ribbon, but I have researched a lot about it and it seems that it is not that much easier.
I was looking at this article, there is a post from a guy called "Mike McGavin", he is asking for the same thing that I'm, and the guy that answer his question tells him that auto resize is not current functionality on custom groups/controls.
Now, that post is 1.5 years old...so I'm hoping something new has been out there, maybe some of you know something about it.
Thanks.
It's in 2010. Scroll down to Custom Group Auto-Scaling section.
http://blogs.technet.com/office2010/archive/2009/11/03/ui-extensibility-in-office-2010.aspx