title: VBA run-time error ‘91’: Object variable or With block variable not set
body: <p>I'm brand new here and although I'm super handy with Excel I have minimal knowledge when it comes to VBA.  I've had an Excel program that we use at work dropped in my lap because it's started throwing multiple errors and I'm the "best" person for the job :(    </p>
  
  <p>I've searched this most excellent forum and a couple others and have been able to solve most of my problems, but now a new error is popping up and I cannot figure out why.</p>
  
  <p>Run-time error ‘91’:
  Object variable or With block variable not set</p>
  
  <p>It pops up when I start the program.</p>
  
  <p>The highlighted area in debugger is:</p>
  
  <pre><code>If ActiveWorkbook.Name = wbkTT Then
  </code></pre>
  
  <p>I'm posting the section of code below</p>
  
  <p>Thanks a lot for any and all help!</p>
  
  <pre><code>' TTV2.xlam version 5/15/12 14:00
  
  Const wbkTT As String = "Time Tracker ver2.xlsm"
  Const RibbonxAddin As String = "TTV2.xlam"
  
  
  Option Explicit
  Private Sub Workbook_Open()
  
  Dim strName As String
  Dim strPath As String
  Dim strNewShow As String
  Dim strDate As String
  Dim strTime As String
  Dim strDepartment As String
  Dim strOS As String
  Dim strVersion As String
  Dim dtFormat As String
  Dim myAddIn As AddIn
  Dim wbkDateOrder As Integer
  Dim timedropdown As Boolean
  
  strVersion = Application.Version
  strOS = Application.OperatingSystem
  dtFormat = DateFormat
  newTTwbk = wbkTT
  
  If strVersion &lt; 14 Then
      MsgBox ("You are running an outdated version of Excel." &amp; Chr(10) &amp; _
          "Time Tracker will only run on MS Excel 2011 for Mac")
      ActiveWorkbook.Close
  Exit Sub
  Else
      wbkDateOrder = Application.International(xlDateOrder)
      strTime = Format(time, "hhmm")
      strDate = Format(Date, "mmdd")
      If ActiveWorkbook.Name = wbkTT Then
          strName = Replace(Workbooks(wbkTT).Sheets("Show Info").Range("A2").Value, " ", "")
          ActiveWorkbook.Sheets("Preferences").Range("D2:D3").NumberFormat = dtFormat
          ActiveWorkbook.Sheets("Data").Range("B:B").NumberFormat = dtFormat
      End If '
  AddMenu
      ActiveWorkbook.Sheets("Preferences").visible = True
      timedropdown = ActiveWorkbook.Sheets("Preferences").Range("E3")
      If timedropdown Then
          ActiveWorkbook.Sheets("Data").Range("G:L").Validation.Delete
          ActiveWorkbook.Sheets("Data").Range("G:L").Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Time"
      Else
          ActiveWorkbook.Sheets("Data").Range("G:L").Validation.Delete
      End If
     If ActiveWorkbook.Sheets("Show Info").Range("A2").Value = "TTV2" Then
          If strOS Like "*Win*" Then
              strPath = ThisWorkbook.Path &amp; "\"
          Else
              strPath = ThisWorkbook.Path &amp; ":"
          End If
          strName = InputBox(Prompt:="Show Name please.", Title:="ENTER SHOW NAME", Default:="Show Name Here")
          strDepartment = InputBox(Prompt:="Enter your Department:", Title:="ENTER DEPARTMENT", Default:="Department Here")
          showcrewform
        If strName = "Show Name Here" Or strName = vbNullString Then
              Exit Sub
          Else
              ActiveWorkbook.Sheets("Show Info").Range("A2").Value = strName
              ActiveWorkbook.Sheets("Show Info").Range("B2").Value = strDepartment
              If Not strOS Like "*Mac*" Then
                  strNewShow = strPath &amp; strName &amp; "_" &amp; strDate &amp; "_" &amp; strTime &amp; ".xlsm"
              Else
                  strNewShow = strPath &amp; strName &amp; "_" &amp; strDate &amp; "_" &amp; strTime &amp; ".xlsm"
              End If
              ActiveWorkbook.SaveAs strNewShow, FileFormat:=xlOpenXMLWorkbookMacroEnabled
              MsgBox ("You are now working on the file: " &amp; strNewShow)
              loadwbkName
              ResetDataSheet
              Exit Sub
          End If
      End If
      If strOS Like "*Mac*" Then
          AddMenu
      End If
      ResetDataSheet
  End If
  End Sub
  </code></pre>