G
Guest
Hi guys, I'm becoming increasingly frustrated with what I think is a
relatively simple procedure.
I am creating a process that requires the user to open a file (I'm not sure
where it will be saved), and then the code will simply copy some data out of
this selected file into the template document.
I currently have:
Public Sub ImportData()
Dim curfolder As String
Dim filename As String
Sheets("Sheet1").Select
Range("A1:ED1000").Select
Selection.ClearContents
Application.GetOpenFilename
filename = Dir(curfolder)
Workbooks.Open filename
Range("A1:ED1000").Select
Selection.Copy
However, when I reach the select file dialog box and select the necessary
file, the file I want isn't actually selected, but the first file in that
folder.
Can someone help me with this predicament please?
Thanks
relatively simple procedure.
I am creating a process that requires the user to open a file (I'm not sure
where it will be saved), and then the code will simply copy some data out of
this selected file into the template document.
I currently have:
Public Sub ImportData()
Dim curfolder As String
Dim filename As String
Sheets("Sheet1").Select
Range("A1:ED1000").Select
Selection.ClearContents
Application.GetOpenFilename
filename = Dir(curfolder)
Workbooks.Open filename
Range("A1:ED1000").Select
Selection.Copy
However, when I reach the select file dialog box and select the necessary
file, the file I want isn't actually selected, but the first file in that
folder.
Can someone help me with this predicament please?
Thanks