cancel
Showing results for 
Search instead for 
Did you mean: 

Using VB to Update a Keyword During Advanced Capture

Keith_Malek1
Star Contributor
Star Contributor

Hello All,

I'm looking for a little VB help here. I'm trying to pull the vale of a keyword and then change it to something different and have it save. I can get it to pull the keyword, supposedly change it but when advanced capture finishes processing the document it's back to is' old value.

Here's my code:

Sub FormAppliedMain

Dim objKeywords
Dim lngIndex

Set objKeywords = OCRDoc.Document.Keywords

msgbox (objKeywords(10).value) 'Show's incorrect value

select case (objKeywords(11).value)
case "17-8921A/15"
objKeywords(10).value = "E"
end select

msgbox (objKeywords(10).value) 'Show's correct value


Call OCRDoc.Document.StoreKeywords()

End Sub

Any ideas on how to have it store E as the keyword?

Thank you in advanced.

1 ACCEPTED ANSWER

Gilberto_Cortes
Star Contributor
Star Contributor

Hello Keith,

I tried the following script which I added in the Form Definition configuration window. It works as long as the document was pre-indexed with a keyword value for the given Keywords index. If it still does not work for you, please let us know.

Sub FormAppliedMain
     ' Executed after a document is finished processing
     Set objDoc = OCRDoc.Document
     Dim objKeys
     Set objKeys = objDoc.Keywords
     MsgBox objKeys(1).value
     objKeys(1).value = "Hello"
 Call objDoc.StoreKeywords()
 MsgBox objKeys(1).value
End Sub

View answer in original post

2 REPLIES 2

Gilberto_Cortes
Star Contributor
Star Contributor

Hello Keith,

I tried the following script which I added in the Form Definition configuration window. It works as long as the document was pre-indexed with a keyword value for the given Keywords index. If it still does not work for you, please let us know.

Sub FormAppliedMain
     ' Executed after a document is finished processing
     Set objDoc = OCRDoc.Document
     Dim objKeys
     Set objKeys = objDoc.Keywords
     MsgBox objKeys(1).value
     objKeys(1).value = "Hello"
 Call objDoc.StoreKeywords()
 MsgBox objKeys(1).value
End Sub

Naveen_Bhat1
Champ in-the-making
Champ in-the-making
You can use script hooks and run it after indexing. That way it will run and check the keyword value and update with the new value.