Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 06-03-2023, 12:40 PM
Charles Kenyon Charles Kenyon is offline Display Navigation and Styles Panes in 365/2021 Windows 11 Display Navigation and Styles Panes in 365/2021 Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,584
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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
In a macro-enabled document where you want this to happen that is not attached to the template, you would need:

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
Keep it mind that there is no way you can force another user to let your macros run.


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.
Reply With Quote
 



Similar Threads
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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft