Here is my problem, I have a Macro which transfer the rows of my choice from one file to another. But every time I click on the export button I have settled, the user needs to find the way back to the folder he needs. So I would like to have instantly acces when I click on the export button to the folder where the file is.
Here is the part of the macro I think there should be something to modify:
Option Explicit
Function SelectSingleFile(Optional Titre As String) As String
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
Dim UNCPath As String
' File filters
Filter = "Excel Files (*.xlsx),*.xlsx," & _
"All Files (*.*),*.*"
' Default Filter to *.*
FilterIndex = 3
' Set Dialog Caption
If Titre <> "" Then
Title = Titre
Else
Title = "Select a file to process"
End If
' Select Start Drive & Path
ChDir (Application.Path)
With Application
' Set File Name to selected File
Filename = .GetOpenFilename(Filter, FilterIndex, Title)
' Reset Start Drive/Path
'ChDrive (Left(.DefaultFilePath, 1))
'ChDir (.DefaultFilePath)
End With
' Exit on Cancel
If Filename = False Then
MsgBox "No file was selected."
SelectSingleFile = ""
Exit Function
End If
SelectSingleFile = Filename
Thank you in advance
Bookmarks