title: use .oleobjects.textbox.text in if statement
body: <p>I have a textbox and an png image on my worksheet (not in userform). The png image loads the calendar and the value selected on calendar is returned to the textbox.</p>
  
  <p>I further want to use the .oleobject in a if loop.
  Like if some xyz variable >= .oleobject</p>
  
  <p>Below is the code for reference.</p>
  
  <pre><code>Sub futurejoiners()
  Dim lr As Long
  
  Windows("EMPDATA.xlsm").Activate
  Sheets("INPUTDATA").Select
  
  lr = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
  
  For i = 2 To lr
  Windows("EMPDATA.xlsm").Activate
  If ThisWorkbook.Sheets("Sheet1").OLEObjects("TextBox2").Object.Text = "" Then
      MsgBox "Please select the reporting start and end dates in Sheet1"
      Exit Sub
  Else
      If Cells(i, "J").value &gt;= ThisWorkbook.Sheets("Sheet1").OLEObjects("TextBox2").Object.Text Then
      Cells(i, "J").Select
      Selection.EntireRow.Delete
      End If
  End If
  Next
  End Sub
  </code></pre>
  
  <p>I get a runtime error 1004 unable to get the oleobjects property of the worksheet class on the if statement where it checks for = ""</p>
  
  <p>I strongly believe something wrong in the way im calling the workbook or worksheet of that oleobject.</p>
  
  <p>Please help. Thanks in advance :)</p>