polps Posted January 8, 2010 Share Posted January 8, 2010 (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 January 8, 2010 by polps Link to comment Share on other sites More sharing options...
picaxe Posted January 8, 2010 Share Posted January 8, 2010 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. Link to comment Share on other sites More sharing options...
polps Posted January 8, 2010 Author Share Posted January 8, 2010 This should work$objSelection.MoveRight(12)You can get the const values from VBA Object Browser. Yes, it works. Tanks a lot. Gianluca Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now