lopiteaux
Board Regular
- Joined
- Jun 8, 2011
- Messages
- 77
Hi,
I have an OpenDialog that needs to be executed prior to executing a bit of code. I currently have it down as follows:
This works great, except for one thing - the default pathname. I am working on a network, and cannot get it to revert to a default pathname, which is written in the following format:
Any thoughts?
C
I have an OpenDialog that needs to be executed prior to executing a bit of code. I currently have it down as follows:
Code:
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
'WF1.1
'OpenDialog Parameters:
'Set File Filters (File Types that can be opened/viewed via the OpenDialog)
Filter = "Excel Files (*.xls),*.xls," & _
"Comma Separated Files (*.csv),*.csv," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
FilterIndex = 2 ' Defaults the File Filter to *.csv.
Title = "Please Select the Relevant Report:" 'OpenDialog caption.
With Application
Filename = .GetOpenFilename(Filter, FilterIndex, Title) 'Creates the OpenDialog box with the defined criteria.
ChDir (.DefaultFilePath) 'Resets the Default Pathname.
End With
'ErrorHandler - Exits the SubRoutine if no File is selected:
If Filename = False Then
msgtitle = "DefaultTitle"
msgbody = "No file was selected."
msgbody = msgbody & vbNewLine & vbNewLine & "Please try again."
msgconfig = vbOKOnly + vbCritical
msgans = MsgBox(msgbody, msgconfig, msgtitle)
Exit Sub
End If
'Open the specified file:
Workbooks.Open Filename
This works great, except for one thing - the default pathname. I am working on a network, and cannot get it to revert to a default pathname, which is written in the following format:
Code:
[/URL][URL="file://abcde12345/Path/Path/Path"]\\abcde12345\Path\Path\Path[/URL][URL="file://\\abcde12345\Path\Path\Path"]
Any thoughts?
C