View Single Post
 
Old 10-27-2022, 09:31 AM
ILauder ILauder is offline Windows 11 Office 2021
Novice
 
Join Date: Oct 2022
Posts: 2
ILauder is on a distinguished road
Default How to set a docs Default Paragraph settings via VBA

How do you set the default paragraph format settings for Space Before, Space After, Line Spacing Rule for the defaults used for the active document?

I know how to set these for individual paragraph selections and paragraph font styles but I can't find where to set the defaults for the whole document.

I've tried recording a macro and making the settings in the UI but the macro doesn't record it.

The UI screen I'm referring to is open a Word document. Click Styles icon, click the Manage Styles button (the A w/ checkmark), click the Set Defaults tab. And I want to set the Before:, After: and Line Spacing: settings via VBA.

I also tried setting the SpaceBefore, SpaceAfter, LineSpacingRule for the built in Word style "Default Paragraph Font" but in VBA that just returns an error that you can't set those for a character style.

I need to change these in a newly created document created in VBA to copy/paste the contents of another file. But the original file's default paragraph settings are different. And Word's VBA functions for PasteAndFormat(wdFormatOriginalFormatting) doesn't retain the original formatting of the source paragraphs when they are text that is inside of text objects. Its picking up the defaults for the new document. So I need to change those to match before pasting in the content.

Many thx if someone knows where to set this.
Reply With Quote