none
ctrl N to macro RRS feed

  • Question

  • I want create macro to create new file in word (like ctrl N)

    I wrote:  Application.Dialogs(wdDialogFileNew).Show
     

    But I get window to select type file to create.

    I want macro as CTRL N do - create new file.

    How am I do it?  

    Tuesday, April 24, 2012 8:29 AM

Answers

  • If you just want code that creates a new, blank document, use this line of code:
     
    Documents.Add

    Stefan Blom, Microsoft Word MVP
    Tuesday, April 24, 2012 9:21 AM
  • You did remove the code to display the dialog box? Documents.Add is the only line necessary to create a new, blank document. Of course, it creates an untitled document which must then be saved.

    Stefan Blom, Microsoft Word MVP
    Tuesday, April 24, 2012 6:09 PM

All replies

  • If you just want code that creates a new, blank document, use this line of code:
     
    Documents.Add

    Stefan Blom, Microsoft Word MVP
    Tuesday, April 24, 2012 9:21 AM
  • It is not work, I still get window to select what type document to create
    • Edited by hila_d Tuesday, April 24, 2012 9:41 AM
    Tuesday, April 24, 2012 9:39 AM
  • Can you post the exact code you are using because Stefan's suggestion should work as advertised, i.e., a blank new document, no dialogue.
    Tuesday, April 24, 2012 12:40 PM
  • You did remove the code to display the dialog box? Documents.Add is the only line necessary to create a new, blank document. Of course, it creates an untitled document which must then be saved.

    Stefan Blom, Microsoft Word MVP
    Tuesday, April 24, 2012 6:09 PM
  • Hi hila,

    How is it going with the program currently?

    Please feel free to let us know if you need any help.

    Thanks.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 25, 2012 9:26 AM
    Moderator