View Single Post
 
Old 06-05-2023, 06:02 AM
Charles Kenyon Charles Kenyon is offline Windows 11 Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 8,900
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

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
Without the TaskPanes statement, it throws an error for the visible property for Styles in CommandBars.


I will be exploring whether Document_New will work instead of AutoNew.
Reply With Quote