Quote:
quote:Originally posted by dpkbahuguna
No no no..
actually there is no syntax problem...
this expression running twice..
ExcelSht.Range("c" & Trim(Str(Cnt1))).AddComment StrComment
first time it is not giving any error but second time error is being raised...
i think this exception is related to ExcelSht Object.
but what?
I dont know...
can you help me?
and thanks for your reply!
DPK..
|
DPK,
you can't add a comment to a cell that already has a comment. Are you changing the value of cnt1?
For example, this gives me an error:
Code:
cnt1 = 1
For k = 1 To 5
strComment = "Test Comment" & k
oExcel.Range("A" & Trim(Str(cnt1))).AddComment strComment
oExcel.ActiveWorkbook.SaveAs ("C:\commenttest.xls")
Next
oExcel.Quit
While this works fine
Code:
for k = 1 To 5
cnt1 = k
strComment = "Test Comment" & k
oExcel.Range("A" & Trim(Str(cnt1))).AddComment strComment
oExcel.ActiveWorkbook.SaveAs ("C:\commenttest.xls")
Next
oExcel.Quit