title: VBA Script Issues - Find Function Returning Error
body: <p><strong>Disclaimer:</strong> Ok so first things first - I am new to VB scripting, so testing and compiling is something of a learning curve at the moment..</p>
  
  <p><strong>My Goal:</strong> Please correct me anywhere I am wrong here - I'm currently using Visual Studio 2017 to edit and test my VB script, and I need it to do the following:</p>
  
  <ol>
  <li>Run on a given folder looking for any Excel .xlsx files</li>
  <li>Find the cell with value "Date" on a worksheet named "Setup" in each file
  
  <ul>
  <li>If it's not there, skip the file</li>
  <li>If it is - update the cell to the right of it to today's date</li>
  </ul></li>
  <li>Refresh all connections in the file, save it and go on to the next one</li>
  <li>Repeat until all are done</li>
  </ol>
  
  <p>So far, it does open all files in a given folder, refreshes connections, saves and closes - but I need it to do <strong>Step 2</strong> above.. Don't mind the commented out parts that are working.</p>
  
  <p><strong>Current State</strong></p>
  
  <p>First attempt looks like below (although incomplete) - now getting an error when building the solution saying I need to "declare" xlValues, xlWhole and xlByRows which should be all part of the Find function as parameters anyway ??</p>
  
  <pre><code>Module RefreshAll_Folder
  Sub Main()
                  Dim ConnectivityPath, RefreshDate, fso, xl, EOMloop, SetupPage, wb
                  Dim sval As Range
  
                  '--- Set variables ---
                  SetupPage = "Setup"
                  RefreshDate = Now
                  ConnectivityPath= "&lt;networkpath&gt;\Connectivity"
  
                  fso = CreateObject("Scripting.FileSystemObject")
                  xl = CreateObject("Excel.Application")
                  EOMloop = fso.GetFolder(ConnectivityPath).Files
  
  
                  '--- FOR CONNECTIVITY ---
  
                  xl.Visible = True
  
                  For Each f In EOMloop
                      If LCase(fso.GetExtensionName(f.Name)) = "xlsx" Then
                          wb = xl.Workbooks.Open(f.Path)
                          wb = wb.Sheets(SetupPage).Range("A1:F7")
  
                          sval = wb.Find(What:="Date", LookIn:=xlValues,
                                  LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
                                  MatchCase:=False, SearchFormat:=False)
  
                          wb.select(sval)
  
                          ' wb.Worksheets("Setup").Range("B2").Value = Now
                          '    wb.RefreshAll
  
                          wb.Save
                          wb.Close
                      End If
                  Next
  
                  xl.Quit
              End Sub
  End Module
  </code></pre>
  
  <p>Thanks for your help in advance!</p>