Sign in to follow this  
Followers 0
polps

Move selection in a Word table

3 posts in this topic

#1 ·  Posted (edited)

Hello all,

I have some trouble with the following code.

I want open a Word document, search for a string (I find the string in a table) and move in the right cell.

The last command $objSelection.MoveRight ("Unit:=wdCell") doesn't work at all, probably due to wrong sintax.

Any suggestion?

$objWord = ObjCreate("Word.Application")
$objWord.Visible = True

$objDoc = $objWord.Documents.Add($Dir & "\" & $File)
$objSelection = $objWord.Selection
$objSelection.Find.Text = "Identificativo"
$objSelection.Find.Execute
$objSelection.MoveRight ("Unit:=wdCell")

Tanks

Gianluca

Edited by polps

Share this post


Link to post
Share on other sites



The last command $objSelection.MoveRight ("Unit:=wdCell") doesn't work at all, probably due to wrong sintax.

This should work
$objSelection.MoveRight(12)
You can get the const values from VBA Object Browser.

Share this post


Link to post
Share on other sites

This should work

$objSelection.MoveRight(12)
You can get the const values from VBA Object Browser.

Yes, it works.

Tanks a lot.

Gianluca

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0