Group:  Microsoft Word ยป microsoft.public.word.vba.beginners
Thread: removing lines / paragraphs

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

removing lines / paragraphs
"Chris" <chris[ at ]abc.com> 29.09.2006 10:01:53
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?



Re: removing lines / paragraphs
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 29.09.2006 10:50:34
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?


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net