|
-
Jul 21st, 2003, 02:55 PM
#1
Thread Starter
Hyperactive Member
Error with VB code interacting with Excel
I am using VB6 and Excel 2000
I am getting the following error:
'Object variable or With block variable not set' with the following code, BUT only when the cell value matches the RowName variable:
Public Function doesRowExist(ExcelWorkSheet As Excel.Worksheet, Column As String, RowName As String) As Boolean
Dim blnExists As Boolean
Dim i As Integer
blnExists = False
'on error goto HandleError
For i = 1 To 1000
If ExcelWorkSheet.Range(Column & i).Value = RowName Then
blnExists = True
Exit For
End If
Next
Set ExcelWorkSheet = Nothing
doesRowExist = blnExists
Exit Function
HandleError:
doesRowExist = False
Set ExcelWorkSheet = Nothing
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|