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

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.

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.

Check macro in Access 2010

Im trying to fix old MS Access file and i have to change popup menu, called by right click. Ive try to find some code in VBA, but i found there only the name of Macro which insert text from popup to form.
When I go to Macro menu i only found name of this macro, but cant change it.
What I should do to see where macro catch text data?
OP discovered the name of the table in the SQL sentence, but was not able to locate it. This was because it was hidden.
To hide/unhide elements in the Nav Pane, you can read:
View and manage objects by using the Navigation Pane

Make a ribbon button reference the macro in a new workbook instance rather than in the source template

I have a macro-enabled Excel template which contains a ribbon button pointing to a macro sub. The button assignment still points to the source template, however, instead of the sub in the new document. If I create a document and then move or delete the template, I'm no longer able to use the button in the new document:
I've noticed that the ribbon button seems have the macro's source template path hard-coded, and there isn't any place I can find in ribbon customization UI to change it:
I'm certain this has been asked before, but I've tried a number of different ways of searching for it without coming up with anything.
I found this which talks about a button on a form, not a ribbon, and I found this which seems to be generating "shapes" programmatically and assigning their action; neither of these two are relevant.
This is the closest I've found, but whereas the QAT customization tab has the option for setting the target:
the ribbon customization tab does not have that. Any help would be greatly appreciated.

PowerPoint VBA code not running unless VB editor opened first

I have a PowerPoint presentation which consists of a single slide and some VBA code. The code displays a dialog box (not inside the presentation) which configures the slide.
I need the code to be started when the presentation is started.
I found various suggestions and ended up going with
this one however I am getting inconsistent results!
If I do the following, in sequence, it works:
Open presentation in PowerPoint
Select Developer tab
Select Visual Basic (to open VBA editor)
Close VBA editor
Select Slide Show tab
Select From Beginning
However, if I skip steps 2-4, it does not! I.E.:
1. Open presentation in PowerPoint
2. Select Slide Show tab
3. Select From Beginning
It is almost as though Visual Basic support isn't even loading until the editor is opened.
I also tried adding a slide before my main one with an auto-transition immediately and again, no-go.
This is driving me insane as I need to get this deployed to the rest of my department.
Anyone have any ideas?
It's kind of a known problem.
OnSlideShowPageChange sometimes doesn't fire. To get around it, add any of the Active-X controls from the Developer tab to the first slide. Scoot it off the slide if you don't want it visible.
Somehow the control forces VBA to initialize, so events fire.
After I did this with your presentation, it fired off right away.

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.