Hello,
I know it's not only excel but I would like to know if someone could help me.
This is my problem:
I would need to open a file with a simple macro from access.
I would like to be able to open a files from a default path.
And then choose one, to open it. Then I would like before to use it, save it to modificate its name and location (because its my template).
This where I am, but I can't open it actually :/ =
Sub SelectFile()
Dim fd As Office.FileDialog
' Create an object FileDialog
Set fd = Application.FileDialog(msoFileDialogOpen)
'Default path
fd.InitialFileName = "C:\Template_Path\"
' Title of the dialogue box
fd.Title = "Open a file ..."
' Not allow multiple selection
' there only one
fd.AllowMultiSelect = False
' Define type of file allow to be open
fd.Filters.Clear
fd.Filters.Add "Excel Workbook", "*.xlsx"
' Display a msgbox
If fd.Show() Then
MsgBox "Vous avez sélectionné le fichier : " _
& vbCrLf & fd.SelectedItems(1), vbInformation
End If
Set fd = Nothing
End Sub
Many thanks everyone
Regards.
D.
Bookmarks