end of doc bookmark? 
Author Message
 end of doc bookmark?

Hi, I am quite new to automation.
I am writing a document that contains text and tables.
Tables require a range and I cannot get my tables to be inserted at the end
of the documents.
All examples I can find of ranges use start & end = 0

-----------------------------------------------------------------
object start = 0;
object end = 0;
Word.Range rng = ThisDocument.Range(ref start, ref end);
ThisDocument.Tables.Add(rng,4, 4, ref missing, ref missing);
-----------------------------------------------------------------

What should 'start' & 'end' be, so that the table is added at the end of the
document.

Any help much appreciated.
Thanks,
Donogh



Mon, 05 Dec 2005 22:14:35 GMT  
 end of doc bookmark?
Hi Donogh,

I think you can use the following:

object start = 0;
object end = 0;
Word.Range rng = ThisDocument.Bookmarks("\EndOfDoc").Range;
ThisDocument.Tables.Add(rng,4, 4, ref missing, ref missing);

For more information about these types of bookmarks, have a look at the VBA
help file topic "Predefined Bookmarks".

HTH


Quote:
> Hi, I am quite new to automation.
> I am writing a document that contains text and tables.
> Tables require a range and I cannot get my tables to be inserted at the
end
> of the documents.
> All examples I can find of ranges use start & end = 0

> -----------------------------------------------------------------
> object start = 0;
> object end = 0;
> Word.Range rng = ThisDocument.Range(ref start, ref end);
> ThisDocument.Tables.Add(rng,4, 4, ref missing, ref missing);
> -----------------------------------------------------------------

> What should 'start' & 'end' be, so that the table is added at the end of
the
> document.

> Any help much appreciated.
> Thanks,
> Donogh



Mon, 05 Dec 2005 22:58:51 GMT  
 end of doc bookmark?
Yes exactly what I was looking for, thanks

in C#

     object oEndofDoc = "\\EndofDoc";
     wrdRng =  oWordApp.ActiveDocument.Bookmarks.Item(ref oEndofDoc).Range;
     oTable = oWordDoc.Tables.Add(wrdRng, 1, 1, ref missing, ref missing);
     oTable.Cell(1,1).Range.Font.Bold = 1;
     oTable.Cell(1,1).Range.Text = "text here";


Quote:
> Hi Donogh,

> I think you can use the following:

> object start = 0;
> object end = 0;
> Word.Range rng = ThisDocument.Bookmarks("\EndOfDoc").Range;
> ThisDocument.Tables.Add(rng,4, 4, ref missing, ref missing);

> For more information about these types of bookmarks, have a look at the
VBA
> help file topic "Predefined Bookmarks".

> HTH



> > Hi, I am quite new to automation.
> > I am writing a document that contains text and tables.
> > Tables require a range and I cannot get my tables to be inserted at the
> end
> > of the documents.
> > All examples I can find of ranges use start & end = 0

> > -----------------------------------------------------------------
> > object start = 0;
> > object end = 0;
> > Word.Range rng = ThisDocument.Range(ref start, ref end);
> > ThisDocument.Tables.Add(rng,4, 4, ref missing, ref missing);
> > -----------------------------------------------------------------

> > What should 'start' & 'end' be, so that the table is added at the end of
> the
> > document.

> > Any help much appreciated.
> > Thanks,
> > Donogh



Tue, 06 Dec 2005 00:20:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Open Word Doc to a specific Bookmark

2. Duplicate bookmark names within 2 autotext insertions in same Word doc

3. listing bookmarks used in a doc.

4. Headers&Footers: Custom Doc Property or Bookmark?

5. Run a procedure until end of doc then repeat it

6. Finding tables in a doc and put them at the end of it

7. Update fields in pg2 header of doc which may or may NOT end up w/pg2

8. Detecting start & end of word doc

9. take bookmarks in current doc & paste over to a 2nd doc

10. no valid bookmark error message, without using bookmarks at all

11. Bookmark as Calculation of other bookmarks

12. Bookmark(2).value from other bookmark

 

 
Powered by phpBB® Forum Software