Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts

    Built-in Dlg (FileOpen) (Word 2007)

    I've written a macro to open a template from the Word 2007 Startup folder and unload it as well. (Unloading a global template before editing VBA is recommned in 2007, and I do find that it's the safe way to proceed.) A similar macro closes and reloads the template. (I've placed both macros on the Developer tab of the Ribbon.)

    I'm finding (with 100% consistency) that double-clicking the file in the FileOpen dialog does not cause .Execute to open the fiile. (The Open buttons functions as expected.) VBA "gets" the name of selected file; the template is unloaded as expected. Is this as intended? I've worked around it by getting the document count as the macro starts; if the count has not incremented by 1, I use Documents.Open to open sFileName. This works well enough, but I'm wondering if a double-click is no longer intended to be the equivalent of the default (Open) button.

    Dim sFileName as String
    ChangeFileOpenDirectory Options.DefaultFilePath(wdStartupPath)
    With Application.Dialogs(wdDialogFileOpen)
    .Display
    sFileName = .Name
    AddIns(sFileName).Installed = False
    .Execute
    End With

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Built-in Dlg (FileOpen) (Word 2007)

    I don't have Word 2007, but according to Displaying Built-in Word Dialog Boxes [Word 2007 Developer Reference], the Execute method should work the same in Word 2007 as in previous versions. I can't find any mention that it doesn't work in the newsgroups. I hope that someone with Word 2007 can test this.

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,892
    Thanks
    0
    Thanked 188 Times in 172 Posts

    Re: Built-in Dlg (FileOpen) (Word 2007)

    Hi Richard,

    I don't have any addins in my startup folder but, if I comment out the line 'AddIns(sFileName).Installed = False' and navigate to a folder where I have some documents and select a file, the .Execute statement seems to work (ie the file opens) with my copy of Word 2007.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    860
    Thanks
    0
    Thanked 10 Times in 9 Posts

    Re: Built-in Dlg (FileOpen) (Word 2007)

    Paul,

    Thanks for giving this a try. I have the problem only when I double-click the file; the Open button functions as expected. I had better luck with this:

    rc = .Display
    If rc = -1 then ' Open button (or double-click)
    .Execute
    End If

    That shouldn't be necessary, but it did trigger the execution I expected. I'll try this in another macro in another project to determine if this was just an anomaly.

    Richard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •