① ボタンのクリック事件:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc =ws.CurrentDocument
content = uidoc.FieldGetText( "Body" ) /文書域の値を取得する
askme = ws.Prompt(PROMPT_OK, _ /プロンプトメッセージを出す、Workspaceのメソッド
"Reminder", content)
Print Strcompare("AB", "ab", 1) /ストータスバーに出力
End Sub
② 外部ファイルの読み込み:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim exapp As Variant
Dim workbook As Variant
Dim worksheet As Variant
Dim myValue As String
Set uidoc =ws.CurrentDocument
'Read the excel file
Set exapp = createobject("Excel.Application") /エクセルアプリを指定する
filenp = "f:\mail.xlsx" /ファイルのパスを指定する
exapp.visible=False
Set WorkBook = exapp.WorkBooks.Open(filenp)
Set WorkSheet = WorkBook.worksheets("Sheet1")
myValue = Trim(WorkSheet.cells(1,1).value) /エクセルシートの値を取得する
Call uidoc.FieldSetText("SendTo", myValue $) /文書域の値を設定する
exapp.Quit /エクセルアプリを閉鎖する
③、ノーツデータベースを開く:
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Messagebox( db.ReplicaID )
Dim db As New NotesDatabase( "", "" )
If db.OpenByReplicaID( "D19DBR11/19/A/IBM", "49257C45002186AD" ) Then
Print( db.Title & " was successfully opened" )
Else
Print( "Unable to open database" )
End If
④、ccにアドレス追加:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim currentCc As String
Set uidoc =ws.CurrentDocument
currentCc = uidoc.FieldGetText( "EnterCopyTo" )
content = uidoc.FieldGetText( "Body" )
Dim DefaultString As String
Dim positionOfChar As Long
DefaultString$ = "/Japan/IBM)"
positionOfChar& = Instr(content, DefaultString$)
Dim subString1 As String
Dim subString2 As String
subString1$ = Left$(content, positionOfChar&+9)
subString2$=Right$(subString1,positionOfChar&-9)
If ( currentCc ="") Then
Call uidoc.FieldSetText( "EnterCopyTo", subString2 )
Elseif ( Instr(currentCc, subString2)=0) Then
Call uidoc.FieldAppendText("EnterCopyTo", "," & subString2)
Else
Exit Sub
End If
End Sub