Hi!,
I want to add Two Blank Lines at starting and end of each page in a Ms Word
document. The margins are pre-set.
The code that I've written can insert two blank lines, but only in the
whole
doucment is merged. It doesn't work if there are paragraphs in between the
document.
The code goes like this:
Sub Macro2()
On Error GoTo dip
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.Fields.Update
Selection.MoveLeft unit:=wdWord, count:=1, Extend:=wdExtend
d = Selection.Fields(Selection.Fields.count).Result
Selection.Fields(Selection.Fields.count).Delete
Dim co As Integer
Dim total As Integer
co = 56 'Line no.
' wdinfo = Word.WdInformation.wdNumberOfPagesInDocument
msg = "Enter Total Number of Pages "
total = InputBox(msg)
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveDown unit:=wdLine, count:=52
If d = total Then
End
Else
Do Until d = total
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.MoveDown unit:=wdLine, count:=co - 2
Selection.MoveUp
Selection.MoveUp
d = d + 1
Loop
End If
Exit Sub
dip:
MsgBox Err.Description
End Sub
regards,
Dipak Goyal