H

I have a vb program inserting a couple of tables into a word document - there are bookmark place-holder

The first table is inserted fine. Then there is a paragraph following in my document (already in the document) and then the second bookmark for the second table

The problem is that the second table is overwriting the first - it is not moving to the second bookmark in the document to insert the second table...

It definitely finds the second bookmark ok

Any ideas ? THanks

my code looks lik

Resume15
On Error GoTo ErrHandler16
.activeDocument.Bookmarks("saleAcceptList").Select ' this is the first bookmar
insertSaleAcceptList person.personID, objW

Resume16
On Error GoTo ErrHandler17
.activeDocument.Bookmarks("saleRejectList").Select ' this is the second bookmar
insertSaleRejectList person.personID, objWd

Re: tables and bookmarks by Peter

Peter
Sat Feb 21 01:10:17 CST 2004

Hi ?

Try posting the code in the insertSaleAcceptList and insertSaleRejectList
procedures because that's where you're doing the insertion.

HTH + Cheers - ???

"=?Utf-8?B?QnJ1Y2UgQmFrZXI=?=" <anonymous@discussions.microsoft.com> wrote
in news:5DBF7515-D304-4327-AF8C-980A0F5415B0@microsoft.com:

> Hi
>
> I have a vb program inserting a couple of tables into a word document -
> there are bookmark place-holders
>
> The first table is inserted fine. Then there is a paragraph following in
> my document (already in the document) and then the second bookmark for
> the second table.
>
> The problem is that the second table is overwriting the first - it is
> not moving to the second bookmark in the document to insert the second
> table....
>
> It definitely finds the second bookmark ok.
>
> Any ideas ? THanks.
>
> my code looks like
>
> Resume15:
> On Error GoTo ErrHandler16:
> .activeDocument.Bookmarks("saleAcceptList").Select ' this is the
> first bookmark insertSaleAcceptList person.personID, objWd
>
> Resume16:
> On Error GoTo ErrHandler17:
> .activeDocument.Bookmarks("saleRejectList").Select ' this is the
> second bookmark insertSaleRejectList person.personID, objWd
>


Re: tables and bookmarks by anonymous

anonymous
Sat Feb 21 01:31:06 CST 2004

insertSaleEntryList calls the following procedure - I've just kept the first few line

Hope this is enough..

thank
Bruc

Private Sub insertSaleHorseList(rs As ADODB.Recordset, objWd As Word.Application
Dim ctr As Intege
Dim wrdSelection As Word.Selectio

Set wrdSelection = objWd.Selectio

' Insert a new table with # bookings + 1 for the heade
objWd.activeDocument.Tables.Add wrdSelection.Range, NumRows:=rs.RecordCount + 1, NumColumns:=


Re: tables and bookmarks by Peter

Peter
Sat Feb 21 02:32:18 CST 2004

Hi Bruce

The code looks fine. It should work as expected as long as the two bookmarks
are in separate paragraphs.

The fact that it's VB/COM is pretty irrelevant, but I'd do some testing with
your document from within Word using VBA. It's just easier to debug. Just
port the parts of your code that select the bookmarks and then insert the
tables and step through the code, toggle backwards and forwards between Word
and the VBA IDE to see exactly where the insertion point is. If all that
works well then it's something else causing the problem.

Try that and let me know how you get on.

BTW what version of Word are you using???

HTH + Cheers - Peter

"=?Utf-8?B?QnJ1Y2UgQmFrZXI=?=" <anonymous@discussions.microsoft.com> wrote
in news:5DBF7515-D304-4327-AF8C-980A0F5415B0@microsoft.com:

> Hi
>
> I have a vb program inserting a couple of tables into a word document -
> there are bookmark place-holders
>
> The first table is inserted fine. Then there is a paragraph following in
> my document (already in the document) and then the second bookmark for
> the second table.
>
> The problem is that the second table is overwriting the first - it is
> not moving to the second bookmark in the document to insert the second
> table....
>
> It definitely finds the second bookmark ok.
>
> Any ideas ? THanks.
>
> my code looks like
>
> Resume15:
> On Error GoTo ErrHandler16:
> .activeDocument.Bookmarks("saleAcceptList").Select ' this is the
> first bookmark insertSaleAcceptList person.personID, objWd
>
> Resume16:
> On Error GoTo ErrHandler17:
> .activeDocument.Bookmarks("saleRejectList").Select ' this is the
> second bookmark insertSaleRejectList person.personID, objWd


Re: tables and bookmarks by anonymous

anonymous
Sat Feb 21 21:51:05 CST 2004

Thanks for your help Pete

I was being particularly stupid - I was referencing table 1 each tim

e.g. With objWd.activeDocument.Tables(1
' Set the column width
.Columns(1).SetWidth 50, wdAdjustNon
.Columns(2).SetWidth 120, wdAdjustNon
.Columns(3).SetWidth 120, wdAdjustNon

thank
Bruce