Revision: 59574
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 18, 2012 23:01 by sjmoorecouk
Initial Code
Function ReturnFileReference(InitialFile As String, Title As String, InitialFolder As String, FilterTo As String) As String Dim Filter As String Dim FilterIndex As Integer Dim Filename As Variant ' File filters Filter = FilterTo 'Filter = "Excel Files (*.xls),*.xls," '& _ "Text Files (*.txt),*.txt," & _ "All Files (*.*),*.*" ' Default Filter to *.* 'FilterIndex = 1 ' Set Dialog Caption ' Select Start Drive & Path ChDrive (Left(InitialFolder, 1)) ChDir (InitialFolder) With Application ' Set File Name to selected File 'Filename = .GetOpenFilename(Filter, FilterIndex, Title) Filename = .GetSaveAsFilename(InitialFile, Filter, FilterIndex, Title) ' Reset Start Drive/Path ChDrive (Left(.DefaultFilePath, 1)) ChDir (.DefaultFilePath) End With ' Exit on Cancel If Filename = False Then ReturnFileReference = "NO_FILE_SELECTED" Exit Function End If ReturnFileReference = Filename End Function
Initial URL
Initial Description
Used to invoke a GetSaveAsFileName dialogue box
Initial Title
Return File Reference
Initial Tags
excel
Initial Language
Visual Basic