Hi,

I have a query about a macro using the get from file function in excel. Specifically I want to extract information from a file, however this file path is depended on a cell information in the excel file. I create the path name based on the strings at the start of the macro. I then point the source of the PDF (highlighted in red in the VBA code see below, this is only an extract of the final code), however I doesn't seem to like that source and I get the error attached. I can't find an example VBA to see what I doing wrong. I think its because the code is actually inserting ''path'' into the excel query rather than the file extension. You can see screenshot from query attached. Any help would be greatly appreciated.

Query shot.jpgerror.jpg

ActiveWorkbook.Queries.Add Name:="Table004 (Page 1) (2)", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Pdf.Tables(File.Contents(path), [Implementation=""1.3""])," & Chr(13) & "" & Chr(10) & " Table004 = Source{[Id=""Table004""]}[Data]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColumnTypes(Table004,{{""Column1"", type text}, {""Column2"", type number}, {""Column3"", type text}, {""Colu" & _
"mn4"", type text}, {""Column5"", type number}, {""Column6"", type text}, {""Column7"", type number}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type"""