2014-05-23 101 views
0

我一直在努力嘗試在VBScript中查找OnBase中的關鍵字。我不知道的方法來查找和獲取基於關鍵字OnBase - 使用VBScript查找關鍵字

值。這是我到目前爲止

'Keywords to Get 
Const KEYWORD_VENDORNO = "Vendor Number" 

Sub Main 
    'Create Application Object 
    Dim objApplication 
    Set objApplication = CreateObject("OnBase.Application") 

    'Get the current document 
    Dim objCurrentDocument 
    Set objCurrentDocument = objApplication.CurrentDocument 

    'Get Collection of Keywords 
    Dim colKeywords 
    Set colKeywords = objCurrentDocument.Keywords 

    'Set Keyword in memory 
    colKeywords.AddKeyword(KEYWORD_VENDORNO,"123") 
    'Save Keyword 
    objCurrentDocument.StoreKeywords 


    'Get Keyword - This is the part I don't know how to get. I can't seem to find the 'right property or method to get the value of the keyword 
'I've tried all the following, but none seem to work. The only one that doesn't give me an 'error is the 2nd one, but it also doesn't give me a value 
    msgbox colKeywords(0) 
    msgbox colKeywords(KEYWORD_VENDORNO) 
    msgbox colKeywords.GetKeyword(KEYWORD_VENDORNO) 
    msgbox colKeywords.FindKeyword(KEYWORD_VENDORNO) 
    msgbox objCurrentDocument.GetKeyword(KEYWORD_VENDORNO) 
    msgbox objCurrentDocument.FindKeyword(KEYWORD_VENDORNO) 
End Sub 

回答

1

您搜索的OnBase Community求助?那裏有很多很棒的資源。

我做了一個「VB關鍵字」的快速搜索,發現this post詢問VB腳本中的文檔句柄。答案是:

嘗試從「documentHandle = document.Handle」之前刪除「set」。

這受this post支持,其中有沒有SET前綴的示例。

嘗試丟棄SET前綴。