Provided the text you want to 'remove' is indeed text then select the text and bookmark it - call the bookmark 'hidden'. The following macro will then give you the option to hide the text (by formatting the font as white) or not.
Dim sQuery As String sQuery = InputBox("Hide letterhead text?" & vbCr & _ "Enter anything but 'Y' to restore the text", "Hide Text", "Y") With Selection .GoTo What:=wdGoToBookmark, Name:="Hidden" If sQuery = "Y" Then .Font.Color = wdColorWhite Else .Font.Color = wdColorAutomatic End If .EndKey Unit:=wdStory End With
Formatting the text as white coloured will leave retain the space the text occupied.
-- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Chris wrote:
[Quoted Text] > Hi I have a word document that is being used as a standard letter. The > word document has bookmarks and is linked to access. > > The standard word document has the company name, address and contact > details at the top of the page, however, when this is printed to > headed paper I would like to remove the company details. > > so how would I write the code to delete the top 7 lines / 1st > paragraph in word?
|