Sub AlignParagraphs()
'Align Left
Selection.Paragraphs.Alignment = wdAlignParagraphLeft
'Align Right
Selection.Paragraphs.Alignment = wdAlignParagraphRight
'Align Center
Selection.Paragraphs.Alignment = wdAlignParagraphCenter
'Align Justify
Selection.Paragraphs.Alignment = wdAlignParagraphJustify
End Sub
Sub AddBrackets()
Dim iCount As Integer
iCount = 1
While Right(Selection.Text, 1) = " " Or _
Right(Selection.Text, 1) = Chr(13)
Selection.MoveLeft Unit:=wdCharacter, Count:=1, _
Extend:=wdExtend
iCount = iCount + 1
Wend
Selection.InsertAfter "]"
Selection.InsertBefore "["
Selection.MoveRight Unit:=wdCharacter, Count:=iCount
End Sub
Sub InsertBeforeSelection()
Dim MyText As String
Dim MyRange As Object
Set MyRange = ActiveDocument.Range
MyText = "<Replace this with your text>"
Selection.InsertBefore (MyText)
MyRange.InsertBefore (MyText)
End Sub
Sub InsertAfterSelection()
Dim MyText As String
Dim MyRange As Object
Set MyRange = ActiveDocument.Range
MyText = "<Replace this with your text>"
Selection.InsertAfter (MyText)
MyRange.Collapse
MyRange.InsertAfter (MyText)
End Sub
ماکروی تغییر Header در Word
یک ماکروی ساده و در عین حال بسیار سودمند در زمانیکه می خواهید عملیاتی را به صورت یکپارچه در محیط Word انجام دهید.
ماکروی زیر متن Header یا سرصفحه سند ورد را با متن دلخواه جایگزین می کند.
Sub ChangeHeader()
Dim MyText As String
MyText = "Header Text !!"
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Range.Text = MyText
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
0 نظر
تازه ترین ها