Excel 2016 (Excel for Office 365) .. Windows desktop version
I'm trying to get to the file modified timestamp of the external (.csv) source data in my worksheet.
Until I started in on this project I was unaware of the terms Power Query and BI ... so I've had a bit of a crash course.
I've come up with a method that appears to work -
My code is triggered by a command button in the workbook, and assumes that there is only one linked table.
My question is in two parts: Is my method sound? and Is there a better method?
I'm trying to get to the file modified timestamp of the external (.csv) source data in my worksheet.
Until I started in on this project I was unaware of the terms Power Query and BI ... so I've had a bit of a crash course.
I've come up with a method that appears to work -
My code is triggered by a command button in the workbook, and assumes that there is only one linked table.
VBA Code:
Private Sub CommandButton1_Click()
Dim sh As Worksheet
Dim var
Set sh = Worksheets("LinkedDataWorksheet") 'descriptive name for this post
var = Split(ActiveWorkbook.Queries(sh.ListObjects(1).Name & "$").Formula, """", 3)
Debug.Print var(1) 'full path to the source file
Debug.Print FileDateTime(var(1)) 'source file date last modified
'other code here
End Sub