title: Loading a worksheet from another workbook into Excel with VBA
body: <p>I am attempting to create a subroutine that prompts the user to select a workbook and then adds the first worksheet of the selected workbook as a tab in the existing (active) workbook. Then names the new tab "Data". Here is the code I am using so far:</p>
  
  <pre><code>Sub getworkbook()
  ' Get workbook...
  Dim ws As Worksheet
  Dim filter As String
  Dim targetWorkbook As Workbook
  
  Set targetWorkbook = Application.ActiveWorkbook
  
  ' get the customer workbook
  filter = "Text files (*.xlsx),*.xlsx"
  caption = "Please Select an input file "
  ws = Application.GetOpenFilename(filter, , caption)
  
  ws.Add After:=Sheets(Sheets.Count)
  
  ws.Name = "DATA"
  
  End Sub
  </code></pre>
  
  <p>This code doesn't seem to be working and is returning the following error: </p>
  
  <blockquote>
    <p>"ws.Add" method or With Block not set.</p>
  </blockquote>
  
  <p>Any help is appreciated.</p>
  
  <p>Thanks,</p>