Hi Guys,
Can you please look at this code:
Sub SelectWorkFiles()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim FilterIndex As Integer, Response As Integer
' Set to Specified Path\Folder
ChDir "P:\Finance\2014\Month closing\0.1 Macro files\B1 - Inventory Movement\Work Files\"
' Set File Filter
Filt = "Excel Files (*.xls*), *.xls*"
' Set *.* to Default
FilterIndex = 5
' Set Dialogue Box Caption
Title = "Please choose your desired file."
' Get FileName
FileName = Application.GetOpenFilename(FileFilter:=Filt, _
FilterIndex:=FilterIndex, Title:=Title, MultiSelect:=False)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical, "Selection Error")
Exit Sub
End If
Workbooks.Open FileName
End Sub
It does not always work....
Although the Drive is specified it still won't open directly into the correct folder.
But if I then select drive P: then exit the selection box, and run the macro again it does open directly to the correct folder.
And for all instances after also.
However when I close the workbook and open it another day again the first time it does not open directly in the correct spot.
This way this macro is not very useful.
Can anybody see where it could go wrong?
Thanks.
Bookmarks