word automation active document copy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    #1

    word automation active document copy

    I'm using the following code to make a copy of the active word document
    after mailmerge has occurred. It copies and pastes the contents of the
    active document into a new document, saves the new document to disk and then
    deletes the new document.

    WordApp.Selecti on.WholeStory()
    WordApp.Selecti on.Copy()
    Dim newDoc As New Word.Document
    newDoc.Activate ()
    WordApp.Selecti on.Paste()
    WordApp.ActiveD ocument.SaveAs( sTempDocumentFi le)

    WordApp.ActiveD ocument.Close(W ord.WdSaveOptio ns.wdDoNotSaveC hanges)
    WordDoc.Close()

    When the original document becomes the active document again, the document
    is highlighted due to the copy operation. I can restore the active document
    and then hit a mouse click which will unhighlight the content. But I want
    to do this in code.

    Any ideas?

    Thanks

    Steve


  • Robinson

    #2
    Re: word automation active document copy


    Try collapsing the selection (I think it's collapsetostart or collapsetoend
    or something - sorry, been a few years with office automation).


    Comment

    • Steve

      #3
      Re: word automation active document copy

      That worked. You would think they would just have a
      WordApp.Selecti on.Cancel or something. Anyway...thanks ...

      Steve

      P.S. Would you have any thoughts on an earlier message I posted regarding
      centering and sizing a word automation active document window (see 12/2/2006
      at 5:01pm)?

      "Robinson" <robinsnewsgrou ps@hotmail.remo ve.this.co.ukwr ote in message
      news:el1mm7$a4a $1$8300dec7@new s.demon.co.uk.. .
      >
      Try collapsing the selection (I think it's collapsetostart or
      collapsetoend
      or something - sorry, been a few years with office automation).
      >
      >

      Comment

      Working...