Hi all,
I'm totally new to word vba but used to Access vba.
I'm opening af word document from Access and would like to insert a table
starting at a bookmark ("start").
However I can only find out how to put the table at the very beginning of
the document with range (rngDoc).
How do I start the table at the bookmark, "start" instead of at the
beginning of the document.
(There maybe other stuff wrong with the below code).
Thanks for any help.
------------------------------
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTbl As Word.Table
Set oWord = CreateObject("word.application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add("c:\filename.dot")
Set rngDoc = oDoc.Range(Start:=0, End:=0)
Set oTbl = oWord.Selection.Tables.Add(rngDoc, 1, 6)

Signature
Jesper Fj?lner
Denmark
Helmut Weber - 05 Mar 2005 14:44 GMT
Hi Jesper,
like this, tested from Excel:
---
Dim oWrd As Word.Application
Dim oDoc As Word.Document
Dim oTbl As Word.Table
Set oWrd = New Word.Application
oWrd.Visible = True
Set oDoc = oWrd.Documents.Open("c:\test\dialoge.doc")
Set oTbl = oDoc.Tables.Add(oDoc.Bookmarks("Marktable").Range, 1, 6)
oTbl.Style = "Tabelle Einfach 1" ' German version
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Jesper Fj?lner - 07 Mar 2005 09:10 GMT
> Dim oWrd As Word.Application
> Dim oDoc As Word.Document
[quoted text clipped - 3 lines]
> Set oDoc = oWrd.Documents.Open("c:\test\dialoge.doc")
> Set oTbl = oDoc.Tables.Add(oDoc.Bookmarks("Marktable").Range, 1, 6)
Great, thank!