Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: RE: MsWord (Smart Techies need reply)


Message #1 by "Jerry Diegel" <diegelj@g...> on Thu, 25 Apr 2002 08:48:44 -0500
You could do this


-----Original Message-----
From: dipak goyal [mailto:dipak.in@n...]
Sent: Thursday, April 25, 2002 2:18 AM
To: professional vb
Subject: [pro_vb] MsWord (Smart Techies need reply)


Hi!

I want to add Two Blank Lines at starting and end of each page in a
document, as it has been specified by our client. The margins are 
pre-set.

The code that I've written can insert two blank lines, It works  only 
when
the whole doucment is merged without spaces or paragraphs.

The code goes like this:

Sub Macro2()
On Error GoTo dip
Selection.Fields.Add Range:=3DSelection.Range, Type:=3DwdFieldPage
Selection.Fields.Update
Selection.MoveLeft unit:=3DwdWord, count:=3D1, Extend:=3DwdExtend
d =3D Selection.Fields(Selection.Fields.count).Result
Selection.Fields(Selection.Fields.count).Delete
Dim co As Integer
Dim total As Integer
co =3D 56
'    wdinfo =3D Word.WdInformation.wdNumberOfPagesInDocument
    msg =3D "Enter Total Number of Pages "
    total =3D InputBox(msg)
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.MoveDown unit:=3DwdLine, count:=3D52
If d =3D total Then
End
Else
  Do Until d =3D total
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.MoveDown unit:=3DwdLine, count:=3Dco - 2
    Selection.MoveUp
    Selection.MoveUp
    d =3D d + 1
  Loop
  End If
Exit Sub
dip:
    MsgBox Err.Description
End Sub

regards,
Dipak Goyal

  Return to Index