title: VBA syntax error for opening up a file and refreshing data connections
body: <p>Not sure what is going on here... making a subroutine in excel vba that opens and activates a file by the values that are passed to it. Obviously I'm doing something wrong... not sure what though.</p>
  
  <pre><code>Sub openBook(ByVal fName As String, ByVal activate As Boolean)
      Application.Workbooks.Open(fName, 0, False) '= Required here?
  End Sub
  </code></pre>
  
  <p><strong>Edit</strong>
  Got that working, just want to check to make sure this is the proper syntax below
  See updated code:</p>
  
  <pre><code>Sub openBook(ByVal fileName As String, ByVal refresh As Boolean)
      Dim wb As Workbook
  
      Set wb = Workbooks.Open(fileName, 0, False)
  
      If refresh = True Then
          wb.RefreshAll
      End If
  
  End Sub
  </code></pre>