Do File Open and default to the MyDocuments dialog box
One way:
Option Explicit
Sub testme()
Dim myDocumentsPath As String
Dim wsh As Object
Dim myFileName As Variant
Dim CurPath As String
Dim wkbk As Workbook
'save the existing current directory
CurPath = CurDir
Set wsh = CreateObject("WScript.Shell")
myDocumentsPath = wsh.SpecialFolders.Item("mydocuments")
'change to the one you want
ChDrive myDocumentsPath
ChDir myDocumentsPath
myFileName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls")
'change back to the old directory
ChDrive CurPath
ChDir CurPath
If myFileName = False Then
Exit Sub
End If
'do what you want--open the file???
set wkbk = workbooks.open(filename:=myfilename)
End Sub
Steven wrote:
How do I create a macro to do a File Open and default to the 'My Documents'
dialog box?
Thank you,
Steven
--
Dave Peterson
|