Click to See Complete Forum and Search --> : Word Selection Object


d0wn_under
September 19th, 2001, 02:33 AM
I have two word documents open and trying to access one of them through VB. For what I am trying to do I need to use the selection object, however I can't find a way to swap the selection object between the two documents, it always seems to point to the first document opened. As the object is read-only I can't find anyway to modify it to get it to point where I want it to point.

Anyone any ideas?

Ta

Robin

Cimperiali
September 19th, 2001, 05:01 AM
'declare objWord in general section of your form
'then substitute in your code:
objWord.ActiveDocument.Select
'debug purpouse
objWord.Selection.InsertAfter ("haha")
'you will now see the right name!
Debug.print objWord.Selection.Document.FullName

If Not objWord.Selection.Find.Execute(TABLE_TAG, true, false, false, false, false, true, wdFindContinue, false, "", wdReplaceNone) then




Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater