hcl-bot
1
Hi,
I need to find a piece of text from a rich text field.I am not able to use Instr.it is throwing error.
Code:-
Set Str_Body = doc.GetFirstItem( “Body” )
Pos = Instr(1,“Business/Activity:” , Str_Body)
What could be the alternative?
Do any of you have did this before? Please help if you have tried this.
Regards,
Varun
Subject: RE: Using Instr in Richtext field
Hi,
According to the posted code, the return data type of doc.GetFirstItem(“Body”) is NotesItem
The InStr function can only take string type as parameter.
Besides, assuming you are searching “Business/Activity:” from variable Str_Body, the syntax should be:
returnPosition = Instr(longlongString, substring).
That is:
Pos = Instr(Str_Body, “Business/Activity:”)
or
Pos = Instr(1, Str_Body, “Business/Activity:”)
Try the following code instead:
dim item_Body as NotesItem
dim Str_Body as String
Set item_Body = doc.GetFirstItem( “Body” )
Str_Body = item_Body.Text
Pos = Instr(Str_Body, “Business/Activity:”)
======== Or the following codes ====
dim Str_Body as String
Str_Body = doc.GetItemValue(“Body”)(0) ’ same as Str_Body = doc.Body(0)
Pos = Instr(Str_Body, “Business/Activity:”)
====
Good Luck
Subject: Using Instr in Richtext field
user str_body(0) for first document .
Subject: RE: Using Instr in Richtext field
Thanks Ajith and Jacob…Its working now with another way found in forum…