VBA code to find current user default download folder, then open a specific file
I'm attempting to dummy proof a macro that will take a downloaded .csv file and import the data then delete itself. I can do this easily on my machine since I know the file paths but making it work for the computers I am sending it to will be another story as the current location of the download folder may be changed.
Code:
Sub Macro1()
Workbooks.Open Filename:="E:\Downloads\Form1.csv"
ActiveCell.FormulaR1C1 = "Reference #"
Cells.Select
Selection.Copy
Windows("testing.xlsm").Activate
Sheets("IMPORT").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("DATA ").Select
End Sub
This is my current macro to copy the downloaded csv to the workbook and set up the rearrangement of the data. What I would like to do is search the registry and replace the E:\Downloads\ with whatever the current user's download folder path is so I can use the form there and then after the import of the data use the same path to delete the file.
Any help would be appreciated :)!