none
Application.Dialogs(wdDialogFileOpen).Display problems RRS feed

  • Question

  • I was trying to override FileOpen, and use:

        Application.Dialogs(wdDialogFileOpen).Display

    to select file, and do custom processing on some files, while passing other files to Word.

    I had a couple of problems with the dialog, however:

    1) If I click "Open in Browser" in the OK button's dropdown menu, I can call ".Execute" to carry out the function later. However, I couldn't find a way to find out it is "Open in Browser" instead of just "Open". Both have the same return value. I looked at the properties mentioned in http://msdn.microsoft.com/en-us/library/bb208812%28v=office.12%29.aspx as well, and they are identical in both cases.

    2) If I click "Open with Transform" in the OK button's dropdown menu, the "Choose an XSL Transformation" dialog does not show. And like "Open in Browser", I couldn't find any indications that "Open with Transform" is clicked instead of "Open".

    3) Selecting multiple files would raise an error. (Run-time error 5174: This file could not be found. (file1.docx file2.docx)) Is there way to get the list of files, or disable multiple selection? (If many files are selected, the list in the error message will be incomplete.)

    Are there ways to solve these problems?

    Thanks.

    Wednesday, April 13, 2011 3:15 PM

All replies

  • Hello,

    From my experience, built-in dialogs in Word are somewhat neglected. Maybe I will have time to check if these issues exist in Word 2010 next week.

    Did you try using Application.FileDialog instead?


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Wednesday, April 13, 2011 5:01 PM
  • Use .Show instead of .Display


    Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "H2O2" wrote in message news:43f79da6-5188-486e-81d3-df6c5e57d5fc@communitybridge.codeplex.com...

    I was trying to override FileOpen, and use:

        Application.Dialogs(wdDialogFileOpen).Display

    to select file, and do custom processing on some files, while passing other files to Word.

    I had a couple of problems with the dialog, however:

    1) If I click "Open in Browser" in the OK button's dropdown menu, I can call ".Execute" to carry out the function later. However, I couldn't find a way to find out it is "Open in Browser" instead of just "Open". Both have the same return value. I looked at the properties mentioned in http://msdn.microsoft.com/en-us/library/bb208812%28v=office.12%29.aspx as well, and they are identical in both cases.

    2) If I click "Open with Transform" in the OK button's dropdown menu, the "Choose an XSL Transformation" dialog does not show. And like "Open in Browser", I couldn't find any indications that "Open with Transform" is clicked instead of "Open".

    3) Selecting multiple files would raise an error. (Run-time error 5174: This file could not be found. (file1.docx file2.docx)) Is there way to get the list of files, or disable multiple selection? (If many files are selected, the list in the error message will be incomplete.)

    Are there ways to solve these problems?

    Thanks.


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    Wednesday, April 13, 2011 7:49 PM
  • Thanks for the response.

    Yes, I tried Application.FileDialog. However, it differs from the original dialog in that:

    - It does not have "Trusted Locations" on the sidebar

    - The OK button does not have the dropdown list of actions

    Since I am trying to override FileOpen, it would be better if I could use the same dialog.


    • Edited by H2O2 Thursday, April 14, 2011 2:14 PM typo
    Thursday, April 14, 2011 6:46 AM
  • Thanks for the response.

    Unfortunately, .Show does not suit my need because it automatically execute the action. However, I need to do some processing before opening the document.

    Thursday, April 14, 2011 6:53 AM