none
open new word in background (macro) RRS feed

  • Question

  • I want create macro to open new document, but I want the new open at background (on screen I show the  current document)? How am I do it? 

    How am I replace between documents?

    Sunday, December 30, 2012 8:04 AM

Answers

  • Hi Hila

    If you look closely at the Documents.Open event you should see a Visible parameter that you can specify optionally. By default, this is "True". Set it to "False" and the document window won't cover the current document.


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, December 30, 2012 11:01 AM
    Moderator
  • That's strange - the new document shouldn't be visible at all.

    But you can try this:

        Dim docCur As Document
        Dim docNew As Document
        Application.ScreenUpdating = False
        Set docCur = ActiveDocument
        Set docNew = Documents.Add
        docCur.Activate
        Application.ScreenUpdating = True


    Regards, Hans Vogelaar

    Sunday, December 30, 2012 12:05 PM
  • Pressing Ctrl+F6 should do that, no macro needed.

    Regards, Hans Vogelaar

    Sunday, December 30, 2012 1:28 PM

All replies

  • Hi Hila

    If you look closely at the Documents.Open event you should see a Visible parameter that you can specify optionally. By default, this is "True". Set it to "False" and the document window won't cover the current document.


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, December 30, 2012 11:01 AM
    Moderator
  • I try

    Documents.Add DocumentType:=wdNewBlankDocument, visible:=False

    but still the new document is in front.

    What am I need to do?

    Sunday, December 30, 2012 11:12 AM
  • That's strange - the new document shouldn't be visible at all.

    But you can try this:

        Dim docCur As Document
        Dim docNew As Document
        Application.ScreenUpdating = False
        Set docCur = ActiveDocument
        Set docNew = Documents.Add
        docCur.Activate
        Application.ScreenUpdating = True


    Regards, Hans Vogelaar

    Sunday, December 30, 2012 12:05 PM
  • thank you.

    Now,How am I create macro to repalce between old and new document?

    Sunday, December 30, 2012 12:25 PM
  • Please explain what you want to do.

    Regards, Hans Vogelaar

    Sunday, December 30, 2012 12:28 PM
  • I want write macro1 to open new document background, and when user want, he use at macro2 to bring the new document he create to front.

    How am I do macro2?

    Sunday, December 30, 2012 12:58 PM
  • Pressing Ctrl+F6 should do that, no macro needed.

    Regards, Hans Vogelaar

    Sunday, December 30, 2012 1:28 PM