title: Automation Error in VBA
body: <p>i am struggling to understand why i receive an automation error when i try to run the below code:</p>
  
  <pre><code>Sub macro
  
  Application.DisplayAlerts = False
  Dim customerBook As Workbook
  Dim filter As String
  Dim caption As String
  Dim customerFilename As String
  Dim customerWorkbook As Workbook
  
  filter = "files (*.xlsx),*.xlsx"
  caption = "Please Select an input file "
  customerFilename = Application.GetOpenFilename(filter, , caption)
  
  Set customerWorkbook = Application.Workbooks.Open(customerFilename)
  
  Dim sourceSheet As Worksheet
  Set sourceSheet = customerWorkbook.Worksheets(1)
  
  Dim j As Integer
  
  j = 2
  While sourceSheet.Cells(j, 1) &lt;&gt; ""
  </code></pre>
  
  <p>The error appears once i create the loop, it appears regardless if i continue the body of the loop or not. I cannot understand why as i have already run a similar macro with such a loop without errors. </p>
  
  <p>Specifically the error is: </p>
  
  <blockquote>
    <p>Run time error '-2147221080 (800401a8): Automation error</p>
  </blockquote>