VBA Code:
Sub rabbit()
Dim myFile As String
Dim FilePicker As FileDialog
Dim B As String
Dim B1() As String
Set FilePicker = Application.FileDialog(msoFileDialogFilePicker)
With FilePicker
.Title = "Choose file"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo Velg
myFile = .SelectedItems(1)
End With
Workbooks.Open Filename:=myFile
Range("A1").Select
ActiveCell.FormulaR1C1 = "=CELL(""filename"")"
B = Range("A1").Value
Selection.ClearContents
B = "='" & B & "'" & "!$A$1"
B1 = Split(B, "]")
B = B1(0) & "]"
***Any better idea how to get the workbook reference? Can I avvoid writing inside the workbook?
The code will turn a filepath into a workbook reference.