Im using following code to select a particular range in a selected sheet in excel
Sub openWordvanuitWord()
Dim excelApp As Excel.Application
Dim Excel As Excel.Workbook
Dim sht As Excel.Worksheet
Set excelApp = CreateObject("Excel.Application")
excelApp.Visible = True
Set Excel = excelApp.Workbooks.Open("C:\Documents and Settings\aa471714\Desktop\Book1.xls")
Set sht = Excel.Worksheets(1)
With sht
.Range("b3:h5").Select
End With
End Sub
Problem is that it want it to select sheet 2. Only when I change
Set sht = Excel.Worksheets(1)
to
Set sht = Excel.Worksheets(2)
I get an error
Anybody suggestions?