mgorecki 0 Newbie Poster

Hello, I'm trying to open an existing Excel file, and read in some cells. When I run the program to test, it gives me "Compile error: Variable not defined." when it gets to the line: "Set ExcelWS = " (in red). ExcelWB is defined, but not ExcelWS. I followed examples from DaniWeb posts and other sources, so I don't know what I did wrong.
Can somebody please help?!

Thanks,
Mark

Dim ExcelApp As Excel.Application
Set ExcelApp = New Excel.Application
Dim ExcelWB As Excel.Workbook
Dim ExcelWS As Excel.Worksheet
Dim ExcelRange As Excel.Range

ExcelApp.Visible = False
Set ExcelWB = ExcelApp.Workbooks.Open("C:\Holding\VBstuff\License_Alert\License_Alert.xls")

CurDate = Date

OpenExcel ("Sigrity")

End Sub

Public Sub OpenExcel(ToolName)
Select Case ToolName
Case "Sigrity"
Set ExcelWS = ExcelWB.Worksheets(1)
Set ExcelRange = ExcelWS.Range("A1:B3")
:
: