Setting Apply Styles dialogue to the side of document view

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Setting Apply Styles dialogue to the side of document view

Post by jmt356 »

Ctrl + shift + s opens the Apply Styles dialogue in Word in the center of my document view. Each time it opens, I need to manually move it to the side of the document. How can I get the dialogue to always open on the side of the document?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

You could create the following macro in Normal.dotm and assign it to Ctrl+Shift+S:

Code: Select all

Sub ApplyStyles()
    With CommandBars("Apply Styles")
        .Left = Application.PointsToPixels(Application.Left)
        .Visible = True
    End With
End Sub
Regards,
Hans

User avatar
Charles Kenyon
3StarLounger
Posts: 284
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Setting Apply Styles dialogue to the side of document vi

Post by Charles Kenyon »

Even handier, in my opinion would be to make it a toggle command.

Code: Select all

Sub ApplyStyles()
    Dim bVisible as Boolean
    With CommandBars("Apply Styles")
        bVisible = Not .Visible
        .Left = Application.PointsToPixels(Application.Left)
        .Visible = bVisible
    End With
End Sub
(I tried ".Visible = Not .Visible" but for some reason the compiler did not like it.)
Last edited by Charles Kenyon on 08 Mar 2020, 20:52, edited 1 time in total.
Attorney Charles Kenyon

Templates in Microsoft Word http://www.addbalance.com/usersguide/templates.htm
Modifying the QAT http://addbalance.com/word/QATmodification.htm

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

For some reason, macros never save properly on my computer. When I create a macro, after a few restarts of Word it usually disappears. I was never able to figure out why.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

There is no way to do what you want without using VBA.
Regards,
Hans

User avatar
Charles Kenyon
3StarLounger
Posts: 284
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Setting Apply Styles dialogue to the side of document vi

Post by Charles Kenyon »

jmt356 wrote:For some reason, macros never save properly on my computer. When I create a macro, after a few restarts of Word it usually disappears. I was never able to figure out why.
This is a MUCH bigger problem.

Try storing them in a separate Global Template rather than in the normal template.
http://www.addbalance.com/usersguide/te ... htm#Global
https://wordmvp.com/FAQs/MacrosVBA/OrganizeMacros.htm
http://gregmaxey.com/word_tip_pages/ins ... acros.html
http://www.addbalance.com/word/movetotemplate.htm

I suspect that if you are in a corporate environment some IT person is replacing your normal.dotm template.
Attorney Charles Kenyon

Templates in Microsoft Word http://www.addbalance.com/usersguide/templates.htm
Modifying the QAT http://addbalance.com/word/QATmodification.htm

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

Ctrl + shift + s opens the Apply Styles windows. Is there a keyboard shortcut to close the Apply Styles dialogue window?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

Make sure that a text box or button in the task pane/dialog has the focus.
Press Ctrl+Spacebar to display a dropdown menu.
Press C to activate Close.
Regards,
Hans

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

Thank you. That accomplishes what I want to achieve (getting the Apply Styles window out of the view) without having to use a macro or manually x it out each time with the mouse.
Regards,

JMT

User avatar
Charles Kenyon
3StarLounger
Posts: 284
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Setting Apply Styles dialogue to the side of document vi

Post by Charles Kenyon »

jmt356 wrote:Ctrl + shift + s opens the Apply Styles windows. Is there a keyboard shortcut to close the Apply Styles dialogue window?
If you use the toggle code I suggested above, Ctrl+Shift+S will open and close the Apply Styles dialog.
Attorney Charles Kenyon

Templates in Microsoft Word http://www.addbalance.com/usersguide/templates.htm
Modifying the QAT http://addbalance.com/word/QATmodification.htm

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

Charles Kenyon wrote:
jmt356 wrote:Ctrl + shift + s opens the Apply Styles windows. Is there a keyboard shortcut to close the Apply Styles dialogue window?
If you use the toggle code I suggested above, Ctrl+Shift+S will open and close the Apply Styles dialog.
I tried using the toggle code you suggested above. I then went to Developer | Macros | selected the Macro and clicked Run. I received the following error:

Run-time error:
Method 'Visible' of object 'CommandBar' failed.

However, on the positive side, the Apply Styles dialogue is now opening on the left of the screen.

How do I assign the macro to ctrl + shift + s?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

Select Fille > Options.
Select 'Customize Ribbon' in the navigation pane on the left.
Click the Customize... button next to 'Keyboard shortcuts' near the bottom of the dialog.
Scroll down the list of Categories and select Macros.
Select ApplyStyles in the list of Macros.
Click in the 'Press new shortcut key' box.
Press Ctrl+Shift+S.
Click Assign.
Regards,
Hans

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

Try this version of the macro:

Code: Select all

Sub ApplyStyles()
    With CommandBars("Apply Styles")
        If .Visible Then
            .Visible = False
        Else
            .Left = Application.PointsToPixels(Application.Left)
            .Visible = True
        End If
    End With
End Sub
Regards,
Hans

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

Hans,

In your list of instructions, I got up to select Macros. I did not see a list of Macros and thus could not select ApplyStyles.

What does your latest Macro (Post=265328) do? Does it move Apply Styles to the Left or toggle the Apply Styles window between visible and invisible when I click press ctrl + shift + s?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

If you don't see macros, you haven't created macros, at least not in the document or template listed in 'Save changes in'.
S3141.png
The latest macro that I posted will close the Apply Styles pane if it's currently open, and display it at the left side of the document/application window if it's currently closed.
You do not have the required permissions to view the files attached to this post.
Regards,
Hans

jmt356
SilverLounger
Posts: 2026
Joined: 28 Mar 2010, 01:49

Re: Setting Apply Styles dialogue to the side of document vi

Post by jmt356 »

I do not see ApplyStyles in in the list of Macros (earlier, I was selecting Macros in the list that displayed when I had Popular Commands displayed under "Choose commands from." But when I choose Macros from "Choose commands from," I see ApplyStyles.

I am using Charles' Macro and it works but now when I launch Apply Styles, the style name name is no longer highlighted so I can no longer tab my way to the Modify button.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 67739
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setting Apply Styles dialogue to the side of document vi

Post by HansV »

I did explicitly mention that you should scroll down the list of Categories and select Macros, not Popular Commands...

Try pressing Ctrl+6 after pressing Ctrl+Shift+S. This should set focus to the style in the taskpane.
Regards,
Hans

User avatar
Charles Kenyon
3StarLounger
Posts: 284
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Setting Apply Styles dialogue to the side of document vi

Post by Charles Kenyon »

jmt356 wrote:I do not see ApplyStyles in in the list of Macros (earlier, I was selecting Macros in the list that displayed when I had Popular Commands displayed under "Choose commands from." But when I choose Macros from "Choose commands from," I see ApplyStyles.

I am using Charles' Macro and it works but now when I launch Apply Styles, the style name name is no longer highlighted so I can no longer tab my way to the Modify button.
The macro was named "ApplyStyles." The command is StyleApplyPane.

Even though the Style is not highlighted, if you click on the Modify button, it will give you the Modify Style dialog for that style.

The following macros may help

Code: Select all

Sub ApplyStylesPosition()
    CommandBars("Apply Styles").Left = Application.PointsToPixels(Application.Left)
End Sub

Sub ApplyStylesHide()
    CommandBars("Apply Styles").Visible = False
End Sub
You would give them their own keyboard shortcuts and use Ctrl+Shift+S to display Apply Styles.
The Position one parks it on the left, whether open or closed but does not change the visible status. Once it is run during a Word session, it will hold the position, unless you otherwise move the Apply Styles pane.
The Hide one closes it.
Attorney Charles Kenyon

Templates in Microsoft Word http://www.addbalance.com/usersguide/templates.htm
Modifying the QAT http://addbalance.com/word/QATmodification.htm