[C#, Word late binding] Next cell (MoveRight)

P

pmeems

This is my first post to this group. So I say hello to all members.

I'm in the process of converting my C# early binding of MS Word to
late binding so I don't have any trouble running my application on a
different pc (using a different version of MS Word).

I'm still struggling with converting these lines of code:
Object oUnit = Word.WdUnits.wdCell;
_WordDoc.ActiveWindow.Selection.MoveRight(ref oUnit, ref _missing, ref
_missing);

What I do is I open a Word template. In this template is a pre-defined
table of 3 columns. I jump to the first cell using a bookmark. Next I
want to insert my text which is coming from an Oracle table.
So I first put the text in the first cell and goto the next cell using
the above code, when I'm at the third cell moving to the next cell
creates a new row and I can continue.

How can I do this using late binding? I've tried these lines of code:
object objSelection = wordType.InvokeMember(
"Selection",
BindingFlags.GetProperty,
null,
wordApplication,
new object[]
{
});
//wdCell = 12
wordType.InvokeMember(
"MoveRight",
BindingFlags.InvokeMethod,
null,
objSelection,
new object[]
{
12
});

But this gave me this error:
This method or property is not available because some or all of the
object
does not refer to a table.

If somebody can help me with this I would really appreciated it.

Thanks
Paul
The Netherlands
 

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