hi all..
how to make indent for new paragraph using VBA/Macro e.g. 1 cm
please, see attached picture
thank in advance
VBA: Make Indent New Paragraph
-
- 3StarLounger
- Posts: 240
- Joined: 17 Feb 2022, 05:16
VBA: Make Indent New Paragraph
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78391
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: VBA: Make Indent New Paragraph
Code: Select all
Sub Indent1Cm()
Selection.ParagraphFormat.FirstLineIndent = CentimetersToPoints(1)
End Sub
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12601
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: VBA: Make Indent New Paragraph
It would be much better to define a paragraph style for this, and then to apply that style to the relevant paragraphs. In your example if "AFTER RUN MACRO" is in a specific style then you could set that style to have a following paragraph in the 1cm indent style that you have defined.
StuartR
-
- 3StarLounger
- Posts: 240
- Joined: 17 Feb 2022, 05:16
Re: VBA: Make Indent New Paragraph
hi Hans, thank you!!!
-
- 3StarLounger
- Posts: 240
- Joined: 17 Feb 2022, 05:16
Re: VBA: Make Indent New Paragraph
hi ..
the macro can't automatically in second paragraph.
i must select/block in 1st & 2nd paragraph then running code.
and how about this problem? i want not change for numbering list
the macro can't automatically in second paragraph.
i must select/block in 1st & 2nd paragraph then running code.
and how about this problem? i want not change for numbering list
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78391
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: VBA: Make Indent New Paragraph
The macro acts on the selected text only. If you don't want to change numbered paragraphs, don't select numbered paragraphs.
Best wishes,
Hans
Hans
-
- PlutoniumLounger
- Posts: 15585
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: VBA: Make Indent New Paragraph
... and set that style to have, as its following paragraph, the same style?
Cheers
Chris
There's nothing heavier than an empty water bottle
-
- 3StarLounger
- Posts: 240
- Joined: 17 Feb 2022, 05:16
Re: VBA: Make Indent New Paragraph
Hi Chris, my paragraph always same style.
-
- PlutoniumLounger
- Posts: 15585
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: VBA: Make Indent New Paragraph
Susan, please accept my apologies. I was being too lazy to explain in full. In this example I am using a paragraph style called "Body Text" (top left of the image).
I decide to Modify the style, and a second pane opens up (right-hand side).
The top-right of the image shows in that second pane that I am modifying the style "Body Text", and finally, when I tap the Enter key to start a new paragraph, then the new paragraph will continue to be in the same style - that of "Body Text".
You can create a paragraph style for the paragraph that begins "Skin Whitening products ...". let's suppose that you call this style "SusansIndent"
When you tap the Enter key after typing " ... Working Group (ZMWG) finds", the new paragraph will automatically be in the same style, that is "SusansIndent".
Even better, the paragraph style you use to type "After Run Macro" can have its following style set to "SusansIndent", so that after you have typed ""After Run Macro"" and tapped the Enter key, you will automatically be in the style "SusansIndent"
Cheers
Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle
-
- 3StarLounger
- Posts: 240
- Joined: 17 Feb 2022, 05:16
Re: VBA: Make Indent New Paragraph
hi chris, thank you.. i will try.
-
- 5StarLounger
- Posts: 609
- Joined: 10 Jan 2016, 15:56
- Location: Madison, Wisconsin
Re: VBA: Make Indent New Paragraph
Note, if you are using automatic numbering, the indent for that is controlled, not in the style, but in the Define New MultiLevel List dialog.
See http://www.shaunakelly.com/word/numberi ... 72010.html.
The numbered items should be using a different paragraph style from your Body Text style, although it can be based on the Body Text style.
I would be handling this through your styles and not involving vba at all.
See http://www.shaunakelly.com/word/numberi ... 72010.html.
The numbered items should be using a different paragraph style from your Body Text style, although it can be based on the Body Text style.
I would be handling this through your styles and not involving vba at all.
Attorney Charles Kenyon
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word
Templates in Microsoft Word
Modifying the QAT
The Importance of Styles in Microsoft Word