Windows 7 Office 2010 - ChangeFileOpenDirectory RRS feed

  • Question

  • The code below works fine with Win XP and Office 2007
     When i use Win 7 and Office 2010 the first time it starts in the default document dir????. The next time it works fine.
    How can i solve this problem?

     strFolder = "p:\test
    ChangeFileOpenDirectory (strFolder)
            With Dialogs(wdDialogFileOpen)
                .Name = strFolder
            End With

    • Edited by pacecal987 Thursday, December 15, 2011 1:14 PM
    Thursday, December 15, 2011 1:12 PM


  • You might try this method, I think it's a bit more reliable.

    Sub OpenDocument()
        With Application.fileDialog(msoFileDialogOpen)
            .Title = "Select File to Open"
            .InitialFileName = "H:\Your Folder\"
            If .Show = 0 Then
                MsgBox "You canceled the open.", vbExclamation, "Open Canceled"
                Exit Sub
            End If
        End With
    End Sub


    Kind Regards, Rich ...
    Friday, December 16, 2011 2:24 AM