I am trying to make a macro where I prompt the user to select a text file, and then have the contents of the selected text file imported to a cell. I managed to get the filedialog and have the user select the file, but then I don't know how to proceed with the importing of the file. Could someone help with this?
This is the (working) code I have so far:
Sub ImportFile()
Dim dFile As FileDialog, result As Integer, it As Variant
Set dFile = Application.FileDialog(msoFileDialogOpen)
dFile.InitialFileName = "G:\"
If dFile.Show = -1 Then
Debug.Print dFile.SelectedItems(1)
End If
End Sub
Thank you in advance!