CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    14

    Word Selection Object

    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


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re:Ok, found it!


    '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
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured