Microsoft Word Add-in Indentation VBA (Visual Basic for Applications)

Microsoft Word Add-in Indentation VBA (Visual Basic for Applications)

Paragraphs.Indent Method

Microsoft Word Paragraph object exposes method to indent or out-indent paragraphs within document. It can be achieved using Paragraphs collection’s Indent method. Note one indent refers to one level of indentation. Given code will do indentation for all the paragraphs in the active document twice, and then it removes one level of the indent for the first paragraph.

Code example

Public Sub IndentParaExample()
	Dim paragraphNumber as Integer
	paragraphNumber=1
	With ActiveDocument.Paragraphs 
		 .Indent 
		 .Indent 
	End With 
	ActiveDocument.Paragraphs(paragraphNumber).Outdent 
End Sub

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Next Understand Addin

Leave a Reply

Your email address will not be published. Required fields are marked *