If a document has a number of pages and one of those pages has a
number of objects (in this case text boxes) how can I select these and
then delete them, please?

There is an "Ah, yes but..." factor here: these pages have a very deep
top margin of about 9 cm. The objects are located in that space
between the top margin and the top edge of the paper.

My code of:
Activedocument.bookmarks("\page").Range.Select
Selection.Delete

...removes everything within the boundaries of the page's margins but
nothing outside of these.

Is there a way of selecting these extra-marginal objects, please?

Regards

Roderick

Re: Deleting objects on page by Stefan

Stefan
Wed Aug 02 02:51:06 CDT 2006

The text boxes could be anchored to the header. To delete header
contents, you need code such as the following:

Selection.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Delete

Selection.Sections(1).Headers(wdHeaderFooterEvenPages) _
.Range.Delete

Selection.Sections(1).Headers(wdHeaderFooterFirstPage) _
.Range.Delete

--
Stefan Blom
Microsoft Word MVP


"Roderick O'Regan" wrote in message
news:aalvc2dmaj6d8lbvus03klooj14rfj04jk@4ax.com...
> If a document has a number of pages and one of those pages has a
> number of objects (in this case text boxes) how can I select these
and
> then delete them, please?
>
> There is an "Ah, yes but..." factor here: these pages have a very
deep
> top margin of about 9 cm. The objects are located in that space
> between the top margin and the top edge of the paper.
>
> My code of:
> Activedocument.bookmarks("\page").Range.Select
> Selection.Delete
>
> ...removes everything within the boundaries of the page's margins
but
> nothing outside of these.
>
> Is there a way of selecting these extra-marginal objects, please?
>
> Regards
>
> Roderick






Re: Deleting objects on page by Roderick

Roderick
Wed Aug 02 03:28:00 CDT 2006

Thanks Stefan for the message.

I wish they were in the headers/footers! Life would be easier as I
could then apply what you have suggested below.

However, these are, and must remain so, on the body of the page but
outside the boundaries of the margins.

Regards

Roderick


On Wed, 2 Aug 2006 09:51:06 +0200, "Stefan Blom" <no.spam@please.xyz>
wrote:

>The text boxes could be anchored to the header. To delete header
>contents, you need code such as the following:
>
>Selection.Sections(1).Headers(wdHeaderFooterPrimary) _
>.Range.Delete
>
>Selection.Sections(1).Headers(wdHeaderFooterEvenPages) _
>.Range.Delete
>
>Selection.Sections(1).Headers(wdHeaderFooterFirstPage) _
>.Range.Delete

Re: Deleting objects on page by Stefan

Stefan
Wed Aug 02 04:15:51 CDT 2006

To which paragraph(s) are the text boxes anchored?

--
Stefan Blom
Microsoft Word MVP


"Roderick O'Regan" wrote in message
news:i6o0d2dbv9i9tuucqpso8dsqil43nv2cf4@4ax.com...
> Thanks Stefan for the message.
>
> I wish they were in the headers/footers! Life would be easier as I
> could then apply what you have suggested below.
>
> However, these are, and must remain so, on the body of the page but
> outside the boundaries of the margins.
>
> Regards
>
> Roderick
>
>
> On Wed, 2 Aug 2006 09:51:06 +0200, "Stefan Blom"
<no.spam@please.xyz>
> wrote:
>
> >The text boxes could be anchored to the header. To delete header
> >contents, you need code such as the following:
> >
> >Selection.Sections(1).Headers(wdHeaderFooterPrimary) _
> >.Range.Delete
> >
> >Selection.Sections(1).Headers(wdHeaderFooterEvenPages) _
> >.Range.Delete
> >
> >Selection.Sections(1).Headers(wdHeaderFooterFirstPage) _
> >.Range.Delete











Re: Deleting objects on page by Roderick

Roderick
Wed Aug 02 04:46:38 CDT 2006

They're anchored and locked to the first paragraph on the page.

On Wed, 2 Aug 2006 11:15:51 +0200, "Stefan Blom" <no.spam@please.xyz>
wrote:

>To which paragraph(s) are the text boxes anchored?

Re: Deleting objects on page by Stefan

Stefan
Wed Aug 02 05:06:24 CDT 2006

This is strange. If you want to, I could take a look at the document.
Email it to sbm01004@hotmail.com.

--
Stefan Blom
Microsoft Word MVP


"Roderick O'Regan" wrote in message
news:u1t0d2ld0kqace8pefljurro0icutkhpi1@4ax.com...
> They're anchored and locked to the first paragraph on the page.
>
> On Wed, 2 Aug 2006 11:15:51 +0200, "Stefan Blom"
<no.spam@please.xyz>
> wrote:
>
> >To which paragraph(s) are the text boxes anchored?




Re: Deleting objects on page by Roderick

Roderick
Wed Aug 02 13:58:50 CDT 2006

Thanks for the offer Stefan but I might have resolved the problem.

This problem always seemed to happen when the objects were on the last
page of the document.

I had the code:
Activedocument.bookmarks("\Page").range.select
Selection.delete

This deleted all the text within the margin but not the surrounding
objects.

These were anchored to the last paragraph in the last page.

Of course, when I looked at the Help topic a little more deeply I saw
the sentence which said that the \Page built-in bookmark does not
select the last paragraph mark on the last page.

As the objects were anchored to this hence they were not deleted.

I resolved it then with:
.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
.Delete

That seemed to do the trick! Objects removed!

Thanks for your help.

Regards

Roderick

On Wed, 2 Aug 2006 12:06:24 +0200, "Stefan Blom" <no.spam@please.xyz>
wrote:

>This is strange. If you want to, I could take a look at the document.
>Email it to sbm01004@hotmail.com.

Re: Deleting objects on page by Stefan

Stefan
Thu Aug 03 02:19:40 CDT 2006

Yes, it is a known fact that the "\page" bookmark does not include the
final paragraph mark of a document. I would have commented on this
earlier, but in a previous message you stated that the text boxes were
anchored to the *first* paragraph of the page... Anyway, I'm glad you
got it sorted!

--
Stefan Blom
Microsoft Word MVP


"Roderick O'Regan" wrote in message
news:60t1d2ph38cjjgbj4grlac0moimod7sn0f@4ax.com...
> Thanks for the offer Stefan but I might have resolved the problem.
>
> This problem always seemed to happen when the objects were on the
last
> page of the document.
>
> I had the code:
> Activedocument.bookmarks("\Page").range.select
> Selection.delete
>
> This deleted all the text within the margin but not the surrounding
> objects.
>
> These were anchored to the last paragraph in the last page.
>
> Of course, when I looked at the Help topic a little more deeply I
saw
> the sentence which said that the \Page built-in bookmark does not
> select the last paragraph mark on the last page.
>
> As the objects were anchored to this hence they were not deleted.
>
> I resolved it then with:
> .MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
> .Delete
>
> That seemed to do the trick! Objects removed!
>
> Thanks for your help.
>
> Regards
>
> Roderick
>
> On Wed, 2 Aug 2006 12:06:24 +0200, "Stefan Blom"
<no.spam@please.xyz>
> wrote:
>
> >This is strange. If you want to, I could take a look at the
document.
> >Email it to sbm01004@hotmail.com.