Hello,
how to check if PQ is valid via VBA code?
Cross posted here: How to check if power query is valid
You can take example files from link.
I am creating PQ formula and query via VBA code:
and problem is when source data is not there...i am getting of course DataSourceError. But it is possible to track this and give error via VBA? How ?
Maybe some workaround ?
I can not just check if file is on disc because i will refer to web server (and there if there is not Table.csv how i could check?)
Please help,
Best,
Jacek
how to check if PQ is valid via VBA code?
Cross posted here: How to check if power query is valid
You can take example files from link.
I am creating PQ formula and query via VBA code:
VBA Code:
Sub Macro1()
ActiveWorkbook.Queries.Add Name:="Table1", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Excel.Workbook(File.Contents(""D:\Pulpit\Newest Pull request\Importing PQ new way\ExampleTable.xlsx""), null, true)," & Chr(13) & "" & Chr(10) & " Table1_Table = Source{[Item=""Table1"",Kind=""Table""]}[Data]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColumnTypes(Table1_Table,{{""Col1"", Int64.Type}, {""Col2"", Int64.Type}, {""Col3"", Int64.Type}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type"""
End Sub
and problem is when source data is not there...i am getting of course DataSourceError. But it is possible to track this and give error via VBA? How ?
Maybe some workaround ?
I can not just check if file is on disc because i will refer to web server (and there if there is not Table.csv how i could check?)
Please help,
Best,
Jacek