title: WorkBookQuery user-defined type not defined
body: <p>I am trying to load a query I have in windows clipboard from powerquery via Macro. But I can't test it because I don't have a reference and I don't know how to guess which one is it:</p>
  <pre><code>Sub readClipboard()
  'Tools -&gt; References -&gt; Microsoft Forms 2.0 Object Library
  'of you will get a &quot;Compile error: user-defined type not defined&quot;
  Dim DataObj As New MSForms.DataObject
  Dim S As String
  Dim currentSheet As Worksheet
  Dim qry As WorkbookQuery
  
  Set currentSheet = Sheets.Add(After:=ActiveSheet)
  
  DataObj.GetFromClipboard
  S = DataObj.GetText
  
  Set qry = ThisWorkbook.Queries.Add(&quot;Prueba&quot;, S, &quot;Nose&quot;)
  
  With currentSheet.ListObjects.Add(SourceType:=0, Source:= _
      &quot;OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=&quot; &amp; Query.Name _
      , Destination:=Range(&quot;$A$1&quot;)).QueryTable
      .CommandType = xlCmdDefault
      .CommandText = Array(&quot;SELECT * FROM [&quot; &amp; Query.Name &amp; &quot;]&quot;)
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .BackgroundQuery = True
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .PreserveColumnInfo = False
      .Refresh BackgroundQuery:=False
  End With
  </code></pre>
  <p>End Sub</p>