none
opening the new document dialoge within c# addin in word 2007/2010 RRS feed

  • Question

  • Hello,

    I'm new to VSDO, and i want to open new template/word dialogue window within word when the button is pressed,

    to simulate the button "New Document or Template"new_word_document_dialogue

    if someone can show me the relevant code for opening this popup/simulate the commandbar, it will be appreciated.

    Roi.

    Wednesday, March 28, 2012 12:24 PM

Answers

  • Use Application.Dialogs[index] collection where index is one of the WdWordDialog constants to retrieve an instance of your appropriate Dialog.

    Then use Dialog.Display or some other methods that best suit your needs.

    • Marked as answer by RoiYsh Sunday, April 1, 2012 10:56 AM
    Wednesday, March 28, 2012 12:55 PM
  • The command, adjusted appropriately for your situation should work.

    ThisAddIn.wApp.Dialogs(Word.WdWordDialog.wdDialogFileNew).Display()


    Kind Regards, Rich ... http://greatcirclelearning.com

    • Marked as answer by RoiYsh Sunday, April 1, 2012 10:57 AM
    Wednesday, March 28, 2012 1:17 PM
  • i'm attaching the relevant code in c#

    Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();

    Object oMissing = System.Reflection.Missing.Value; oWord.Visible = true; oWord.Activate(); oWord.Dialogs[WdWordDialog.wdDialogFileNew].Show(oMissing);



    • Marked as answer by RoiYsh Sunday, April 1, 2012 11:01 AM
    • Edited by RoiYsh Sunday, April 1, 2012 11:18 AM
    Sunday, April 1, 2012 11:01 AM

All replies

  • Use Application.Dialogs[index] collection where index is one of the WdWordDialog constants to retrieve an instance of your appropriate Dialog.

    Then use Dialog.Display or some other methods that best suit your needs.

    • Marked as answer by RoiYsh Sunday, April 1, 2012 10:56 AM
    Wednesday, March 28, 2012 12:55 PM
  • The command, adjusted appropriately for your situation should work.

    ThisAddIn.wApp.Dialogs(Word.WdWordDialog.wdDialogFileNew).Display()


    Kind Regards, Rich ... http://greatcirclelearning.com

    • Marked as answer by RoiYsh Sunday, April 1, 2012 10:57 AM
    Wednesday, March 28, 2012 1:17 PM
  • i'm attaching the relevant code in c#

    Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();

    Object oMissing = System.Reflection.Missing.Value; oWord.Visible = true; oWord.Activate(); oWord.Dialogs[WdWordDialog.wdDialogFileNew].Show(oMissing);



    • Marked as answer by RoiYsh Sunday, April 1, 2012 11:01 AM
    • Edited by RoiYsh Sunday, April 1, 2012 11:18 AM
    Sunday, April 1, 2012 11:01 AM
  • Hi Use the below line if you want to open the New Document window on the same Add In

     Globals.ThisAddIn.Application.ActiveDocument.Windows.Application.Dialogs[Word.WdWordDialog.wdDialogFileNew].Display();

    Wednesday, September 26, 2012 7:58 PM