![]() |
#1
|
|||
|
|||
![]()
Okay, I am being forced at gunpoint (==contract paycheck) to use Word 365. My macro, as above, doesn't work, and although I've searched, no one seems to have wanted a sticky Styles pane since about 2014.
Can anyone provide a current macro that will open Nav and Styles, and preferably allow a width setting for each, under 365? (ETA: Not sure if it's me or 365, but I can't record any form of this macro that would either work or point me to the right VBA elements. I just get an empty macro frame.) Thx...! Last edited by NitroPress; 06-02-2023 at 06:05 PM. |
#2
|
|||
|
|||
![]()
Since this is a new topic, I moved it into its own thread to get the best answers.
I've been trying to do this, futilely, since Word 2019, at least. I had a macro that worked in Word 2013 but does not now. It may have been broken in Word 2016 but I do not remember when I noticed. Here is my Add-In, it still has the code in it for the Styles Pane width but I've disabled that. Navigation Pane Settings at Word Startup Last edited by Charles Kenyon; 06-03-2023 at 12:24 PM. |
#3
|
|||
|
|||
![]()
Thanks for the attention to this.
At least that explains why there aren't previous/canned solutions out there for search. Even with my very low regard for what MS has done to Office in the last few revs, I am boggled that this very useful functionality would be removed, even at a low VBA level. In most of my contracts, I reshape Word docs or libraries around style-based maintenance, and a key element is to force users to open and see the Styles list, so that they can begin to understand its purpose and usefulness. But if it's a manual step, they won't do it... and the ribbon Styles block is massively useless marketing decoration at best. Sigh. Thanks, though. |
#4
|
|||
|
|||
![]()
I share your view of the [Quick] Styles Gallery. It, too, has been degraded by the "New Experience" view. New Experience/Visual Refresh Preview - Microsoft Office - Offic e 365 - Turning it On and Off I suspect that some of the developers at Microsoft do not understand the utility of styles.
The Quick Styles and Quick Style Sets can be very useful. [Quick] Style Sets and Word Themes in Microsoft Word. |
#5
|
|||
|
|||
![]()
The following command works in Word 2010 but not in Word 365/2021.
Code:
application.commandbars("Styles").visible = True Giving Feedback on Microsoft Word or other Microsoft Products I just filed a new one and you are welcome to vote and comment on it. Quote:
|
#6
|
|||
|
|||
![]()
Although I continue to consider this a bug, Application.TaskPanes(wdTaskPanesFormatting).Visib le is a workaround.
That changes the Styles Pane visible property. Positioning must still be done using the CommandBars. |
#7
|
|||
|
|||
![]()
My Add-In at
Navigation Pane Settings at Word Startup does have code to display the Styles Pane but not change the width of that pane. The Add-In is to let a user set preferences for all documents. Again Application.TaskPanes(wdTaskPanesFormatting).Visib le = True will display the Styles Pane. If you add the following to your templates where you want to force display of the Styles and Navigation Panes it should work: Code:
Sub AutoNew() ' Charles Kenyon 2023-06-03 ' Display Navigation Pane and Styles Pane upon creation of new document based on this template ' https://www.msofficeforums.com/175437-post7.html ' With Application.CommandBars("Navigation") .Width = 250 ' set to whatevery you want - the default seems wide at 400 .Visible = True .Position = msoBarLeft End With Application.TaskPanes(wdTaskPaneFormatting).Visible = True Application.CommandBars("Styles").Position = msoBarRight End Sub Code:
Sub AutoOpen() Application.Run AutoNew End Sub Code:
Sub AutoOpen() ' Charles Kenyon 2023-06-03 ' Display Navigation Pane and Styles Pane upon opening this document With Application.CommandBars("Navigation") .Width = 250 ' set to whatevery you want - the default seems wide at 400 .Visible = True .Position = msoBarLeft End With Application.TaskPanes(wdTaskPaneFormatting).Visible = True Application.CommandBars("Styles").Position = msoBarRight End Sub AFAIK, there is currently no way to change the width of the Styles Pane using vba. I believe this changed with Word 2013. The TaskPanes collection does not have width and Word does not pay any attention to it in CommandBars("Styles").Width. Last edited by Charles Kenyon; 06-04-2023 at 06:46 PM. |
#8
|
||||
|
||||
![]()
This appears to work on my Word 2016 and 365 machines
Code:
With Application.CommandBars("Navigation") .Width = 300 ' set to whatever you want - the default seems wide at 400 .Visible = True .Position = msoBarLeft End With 'Application.TaskPanes(wdTaskPaneFormatting).Visible = True With Application.CommandBars("Styles") .Visible = True .Position = msoBarRight .Width = 600 End With
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#9
|
|||
|
|||
![]() Quote:
I wish it would on mine! If I comment out the line with visible, it will run but the Styles Pane is not visible. With the TaskPanes line, it will become visible, however the .Width property is not applied. When I try it in Safe Mode on 365, it works, sort of! It halts on the first line. If I display and then hide the Navigation and Styles Panes, it runs and works. If I display and then hide only the Navigation Pane, it halts on the Styles CommandBar. Time for some debugging! |
#10
|
|||
|
|||
![]()
I do not know what happened, but now the Width property can be set in the Styles pane under CommandBars! This is not in safe mode.
|
#11
|
||||
|
||||
![]()
I did get an error initially on 365 but then it worked.
I think if you add an On Error Resume Next and then re-enable the TaskPanes line then I expect either one or both will work and if it errors then the second one gets it done anyway.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#12
|
|||
|
|||
![]()
If I run the code when Word starts, with neither the Navigation Pane nor the Styles Pane having been visible, I get a problem with visible on the CommandBars("Styles").Visible setting.
Note, it does not choke on the Navigation Pane even though it did in Safe mode! Currently, on my 365 machine, without safe mode, the following runs fine when called but does not run automatically even when named AutoNew in the Normal template: Code:
Sub AutoNewStylesNavPane() ' Charles Kenyon 2023-06-03 ' Display Navigation Pane and Styles Pane upon creation of new document based on this template - rename to AutoNew ' https://www.msofficeforums.com/175437-post7.html ' With Application.CommandBars("Navigation") .Width = 250 ' set to whatevery you want - the default seems wide at 400 .Visible = True .Position = msoBarLeft ' anchors to left side End With Application.TaskPanes(wdTaskPaneFormatting).Visible = True ' CommandBars("Styles").Visible will throw an error With Application.CommandBars("Styles") .Visible = True .Position = msoBarRight ' anchors to right side .Width = 300 ' sets width End With End Sub I will be exploring whether Document_New will work instead of AutoNew. |
#13
|
|||
|
|||
![]()
When in the Document_New procedure in ThisDocument of Normal.dotm, it does not run. If the Navigation Pane was closed when Word was closed, then it does not activate the Navigation Pane. It does not activate the Styles Pane upon Word startup.
When a new document is created with Word open, it runs showing both panes and adjusting the width as set in the macro. If in the Document_Open procedure in ThisDocument in Normal.dotm, it has no effect on Word's startup status for either pane. When a document or template is opened from Windows explorer, it has no effect. When a document is opened using File > Open from within Word, it runs. Curiouser and curiouser! perplex.jpg @NitroPress I suspect you will need to have Word already open to have the macros I gave earlier work for you. Warn your users! |
#14
|
|||
|
|||
![]() Quote:
Andrew, Thank you for the suggestion. SpeakEasy, in Eileen's Lounge, suggested: ActiveDocument.CommandBars.ExecuteMso "StylesPane" Nothing with the Styles Pane will work in AutoExec because there is no document open and Word won't display the Styles Pane without an open document. Once a document is open and the StylesPane has been activated in some manner, apparently both visible and width work. |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Quick Styles display changed - just an alert | Charles Kenyon | Word | 2 | 11-22-2021 03:04 PM |
Unable to connect Styles to the Navigation column. | Balliol | Word | 5 | 08-04-2019 04:25 AM |
Using the Navigation Pane with modified styles | susandickerson | Word | 3 | 07-10-2014 08:35 PM |
How to Customize Outlook Panes | Steve_B | Outlook | 0 | 07-08-2014 09:05 AM |
Can't Display "Recently Used Styles" in Styles Pane | mwildem | Word | 2 | 05-23-2012 01:42 PM |