Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    May 2002
    Location
    Hawaii
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dialogs Collection (2000/SP-3)

    In a VB module, I would like to retrieve the filename selected while using the Dialogs().Display method. I am using:

    objWord.Dialogs(wdDialogFileNew).Display

    but cannot find a way to access the filename once I click on OK in the dialog box. Can anyone help?

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Dialogs Collection (2000/SP-3)

    If you search the Word VBA help file for "Built in dialog box" then you will find that the arguments for the FileNew dialog box are
    Template, NewTemplate, DocumentType, Visible

    There is no filename argument, and this makes sense because when I display that dialog box all I get to do is select a template.

    I just tested this and it appears to be one of those dialog boxes where .Display does the same as .Show, and the .Template argument always appears to return "Normal" - presumably it is for you to set rather than retrieve.

    Could you get the information you want by

    objWord.Dialogs(wdDialogFileNew).Show
    MsgBox objWord.ActiveDocument.AttachedTemplate <font color=448800>' this is the template that was selected</font color=448800>

    StuartR

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Dialogs Collection (2000/SP-3)

    In case you were inclined to chase the WordBasic object to see if its behavior is different than Stuart described, unfortunately, it isn't:

    Sub WBFileNewTester()
    Dim dlgFN As Object
    Set dlgFN = WordBasic.dialogrecord.filenew(False)
    If WordBasic.Dialog.filenew(dlgFN) <> 0 Then 'oops, new doc is created
    Stop 'no attributes in the locals window; weird
    End If
    Set dlgFN = Nothing
    End Sub

  4. #4
    Star Lounger
    Join Date
    May 2002
    Location
    Hawaii
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dialogs Collection (2000/SP-3)

    I was hoping to avoid the .Show method. I want it all to happen in the background while running the routine from MS Access. I intend to generate documents from within Access using the Word object. My need to access the document template from which to generate the document can be fulfilled using another common dialog routine, but it would have been much more appealing and efficient if I could use the Word dialog to access the file. It looks like it's a no-go though.

    Thanks for the suggestion.

  5. #5
    Star Lounger
    Join Date
    May 2002
    Location
    Hawaii
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dialogs Collection (2000/SP-3)

    Yep, I tried it and came to the same conclusion. You'd think it would be easy to access the filename from the dialog. What's the point of accessing the dialog programatically if it does not allow access to the filename? Thank you MS <img src=/S/razz.gif border=0 alt=razz width=25 height=17>

Posting Permissions

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