In Excel, is there a way to determine the method being called by a password protected 3rd-party ribbon button? - vba

I'm looking to automate a simple process in VBA and need to "click" a ribbon button. It makes the most sense to just call the button's underlying method. Is there a way to figure out what it is?
We are using Excel 2007 and 2010.

If it's Excel 2003 or earlier, you can use the CommandbarControl.Execute method. For instance:
Application.Commandbars("3rd Party Toolbar").Controls("Button to Push").Execute

There are two ways you can do this.
Right click on the toolbar and select Customise. If you right click on the button there may be details somewhere of what Macro the button is associated with.
If you record a macro and click the button. Then you can look at the VBA workspace and view the code that is generated to run your macro (which is just clicking the button you want). This will show you what method the macro clicks.

Related

Manipulate the MS-Word Navigation Pane via VBA-Macro [duplicate]

I am trying to write a VBA macro that runs when opening a .docx document. I want it to force the display of the Navigation Pane and then force all of the headings (any level) to display in collapsed mode. I am trying to get the code for the Collapse command using the macro recorder.
All I have when I record the macro is:
ActiveWindow.DocumentMap = True
Right-clicking on a heading in the Navigation Pane and collapsing does not record a code line. Is there a VBA method for this event?
I "solved" this requirement for myself by means of an AutoHotKey script, which just sends the necessary mouse click and subsequent key strokes. Not beautiful, but it works most of the times.
Kind regards, Hauke
As of this writing in 2019, this is not possible through VBA. It's been asked for from Microsoft for a long time.
As originally suggested in this Microsoft forum post, the quickest way to collapse all of the headings in the Navigation pane is to right-click one of the headings and click Collapse All. Obviously this is not an automated/macro-based solution, but it's all we have until Microsoft exposes the task panes through the VBA object model.

How do I make a userform appear on demand in Microsoft Word?

I can make it popup on opening the document, but what if I close the userform and want to it to show up again in the same document? I know in excel you can add a button onto a worksheet directly and make it show the userform on click, but this button is unavailable for microsoft Word. Is there a solution besides initiating the script by hand?
To display a VBA userform, you can trigger it from a macrobutton field, from a form field, from a shape, from a QAT button or from an ActiveX button. There are probably a couple of other methods I'm not remembering at the moment. Each is a little different in the exact steps, but all will run the command:
UserFormName.Show

Navigation Pane in Word 2016: VBA code to force collapsed view of headings

I am trying to write a VBA macro that runs when opening a .docx document. I want it to force the display of the Navigation Pane and then force all of the headings (any level) to display in collapsed mode. I am trying to get the code for the Collapse command using the macro recorder.
All I have when I record the macro is:
ActiveWindow.DocumentMap = True
Right-clicking on a heading in the Navigation Pane and collapsing does not record a code line. Is there a VBA method for this event?
I "solved" this requirement for myself by means of an AutoHotKey script, which just sends the necessary mouse click and subsequent key strokes. Not beautiful, but it works most of the times.
Kind regards, Hauke
As of this writing in 2019, this is not possible through VBA. It's been asked for from Microsoft for a long time.
As originally suggested in this Microsoft forum post, the quickest way to collapse all of the headings in the Navigation pane is to right-click one of the headings and click Collapse All. Obviously this is not an automated/macro-based solution, but it's all we have until Microsoft exposes the task panes through the VBA object model.

MS excel Vb.net ui

I am new in excel vb.net programming. I am building a excel add-in like the image attached. I have searched but did not find a way to create its UI like the attached image. Please let me know if its possible or not, if yes, please provide me the links.
Thank you so much
You can easily add your own buttons, graphics to Excel or any Office product (Word/Power Point/Excel/ etc) by simply right clicking the ribbon area, then choosing [Customize the Ribbon].
In the next window, if you want your buttons to be displayed on their own Ribbon, create a new Ribbon.
Add as many buttons as you want, and you can separate them if you like.
You can read more about Customizing Ribbons in Office products here.
You can create a new tab on your ribbon as Ahmad has mentioned. You can then add buttons to your new ribbon tab and have them execute macros that you have written. For example, if while working in Excel, you have to highlight cells often with yellow, you can write a macro in your personal workbook then have a button in your new tab execute that macro.

How do I launch a Word VBA Application from a Form (not a document)?

I created a Word Application using VBA. At present, I launch it from the IDE associated with a particular document. When my app launches, I click a Command Button on a Form to begin processing my data.
Question: How do I launch this application directly from the Form? Perhaps I can fashion my Word document to look like my Form.
If you don't need a form to collect information from the user, you can run macros directly from Word. Go to the View Ribbon tab and click the Macros button on the far right (or press Alt-F8).