Inserting table at cursor

  • Thread starter Jesper Fjølner
  • Start date
J

Jesper Fjølner

I want to insert a table at the cursor and place the cursor in the first
cell.
I'm using :

Dim oTbl as word.table
Set oTbl = ActiveDocument.Tables.Add(oWord.Selection.Range, 1, 6)
oTbl.Select

but I get an error saying that the add method failed. What wrong?
Thanks for your help.
 
J

Jean-Guy Marcil

Jesper Fjølner was telling us:
Jesper Fjølner nous racontait que :
I want to insert a table at the cursor and place the cursor in the
first cell.
I'm using :

Dim oTbl as word.table
Set oTbl = ActiveDocument.Tables.Add(oWord.Selection.Range, 1, 6)
oTbl.Select

but I get an error saying that the add method failed. What wrong?
Thanks for your help.

Where and how is oWord defined?

By the way, you do not need special code to place the cursor in the first
cell. After the Add method executes. the cursor is automatically in the
first cell.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top