THe code provided works fine when i run it as it is
but when i add the following lines of code
- Dim objexcel As Excel.Application
-
Dim wbexcel As Excel.Workbook
-
Dim wbExists As Boolean
-
Dim objSht As Excel.Worksheet
-
Dim objRange As Excel.Range
-
-
-
Set objexcel = CreateObject("excel.Application")
-
objexcel.Visible = True
-
On Error GoTo Openwb
-
wbExists = False
-
Set wbexcel = objexcel.Workbooks.Open("C:\Documents and Settings\TAYYAPP\Desktop\test folder\reports\ERROR REPORT3.xls")
-
Set objSht = wbexcel.Worksheets("Sheet1")
-
objSht.Activate
-
wbExists = True
-
Openwb:
-
-
On Error GoTo 0
-
If Not wbExists Then
-
objexcel.Workbooks.Add
-
Set wbexcel = objexcel.ActiveWorkbook
-
Set objSht = wbexcel.Worksheets("Sheet1")
-
-
End If
in the beginning i get some parameter expected runtime error in line no 31 of the code given in post 1.
what i dont understand is there is no connection between the two sets of codes
th e exact runtime error is 2147217904(80040e10)