File Open Dialog

File Open dialog

[vb autolinks=”false” classname=”myclass” collapse=”false” firstline=”1″ gutter=”true” highlight=”” htmlscript=”false” light=”false” padlinenumbers=”false” smarttabs=”true” tabsize=”4″ toolbar=”true” title=”File Open”]

Private Sub fileOpenDialog()
Dim FileToOpen As Variant

‘Set directory for file selection
ChDrive "X:"
ChDir "X:\ProductivityReports"

FileToOpen = Application.GetOpenFilename _
(Title:="Please choose the previous month Nat Profit Tracker", _
FileFilter:="Excel Files *.xls (*.xls),")

If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "Select Nat Profit Tracker!!!"
Exit Sub
Else
Workbooks.Open FileName:=FileToOpen
End If

End Sub
[/vb]