Hello,

I am Trying to open a excel sheet ,the name of excel sheet i am assigning in the text box, i need to open the sheet " Employee Attendence" and write in the cells(1,1) ="hai"

i have written the below code

Code:
Private Sub Command1_Click(Index As Integer)
   Dim vari As String
  Dim uppxl    As Excel.Application
  Dim upxwb As Excel.Workbook
  Dim upxws As Excel.Worksheet
  vari = eempid.Text
'error is here
  Set upxwb = uppxl.Workbooks.Open(App.Path & "\" & eempid.Text & ".xlsx")
'error is here
 Set upxws = upxwb.Worksheets("Employee Attendence")
 With upxws
 .Cells(1, 1).Value = "hai"
  End With
 upxwb.Close SaveChanges:=True
 Set upxwb = Nothing
 uppxl.Quit
 Set uppxl = Nothing
        
End Sub
i am getting a runtime error 91 ,object variable or With block variable not set.

kindly help