Open Data Source directory

  • I've been looking around on google for about a week, but haven't found a way to force force the dialog box for opening a mail merger data source to start in a specific directory. I saw the ability to do this to a regular file open dialog, but it didn't appear to work with the data source window.

    Would any of you twenty good people have a clue how I could go about achieving this?

    On a significantly lesser note, I'm also having trouble verifying that another macro exists before this one I'm creating starts its mojo. I currently have error checking for this, but I'm curious if there is a way to check for a macro without actually attempting to execute it.

    Thank you so much in advance for any help!

  • Re: Open Data Source directory

    Not sure on the second one, but think if you look at Dialogs in the VBE Help you should find some help on the first question


    From Help...


    Built-in dialog box argument lists
    Many of the built-in Microsoft Word dialog boxes have arguments that you can use to set or get values from a dialog box. For more information, see Displaying built-in Word dialog boxes.

    D ;)

    :sailboat: [SIZE=1]Better a bad day on the water than a good day in the office[/SIZE]

  • Re: Open Data Source directory

    The best bets I've found in both Word's help on the subject, and google were .InitDir, ChDir, wdDocumentsPath, DefaultFilePath, and ChangeFileOpenDirectory. None of which worked.

    This is the bit of code I've got, which always ends up opening to My Documents\My Data Sources

    Set mydialog = Dialogs(wdDialogMailMergeOpenDataSource)
        With mydialog
        End With

    I'm putting these things right before .Show in the code above. Am I doing something wrong? Or do these simply not work with this dialog box?

  • Re: Open Data Source directory

    Have you checked help where you will find a list of the arguments for each dialog?

    This is the list for wdDialogMailMergeOpenDataSource.

    Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible

  • Re: Open Data Source directory

    I did see that. None of those struck me as the correct thing to use.

    I'm trying to prompt the user to open another Word document from a specific directory as the data source. The actual data file will be different in each case, but they'll all be in the same directory.

    Unless I'm wrong, which may be highly likely, heh- most of the mail merger data source options look to be for Access/SQL databases, not Word documents.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!