ノーツ文書をPDFの添付として送信する

Sub Click(Source As Button)
   
  '// Declarations
  Dim wApp As Variant
  Dim ws As NotesUIWorkspace
  Dim s As NotesSession
  Dim uidoc As NotesUIDocument, nuidoc As NotesUIDocument
  Dim path As String, fpath As String, unid As String
  Dim doc As NotesDocument 
  Dim rt As NotesRichTextITem 
  Dim mdb As NotesDatabase 
   
  '// Set temp file location
  tpath = "C:\Personal\"
   
  '// Initialize
  Set s = New NotesSession 
  Set ws = New notesuiworkspace
  Set uidoc = ws.CurrentDocument
  unid = uidoc.Document.UniversalID
  fpath = tpath+unid+".pdf"
  Call uidoc.SelectAll
  Call uidoc.Copy
   
  '// Open OLE Object
  Set wApp=CreateObject("Word.Application")
  wApp.Visible=visibility
  Call wApp.Documents.Add()
  wApp.Visible = False
  wApp.Selection.Paste
  wApp.ActiveDocument.SaveAs fpath, 17
   
  '// Close OLE Object 
  wApp.ActiveDocument.Close wdSaveChanges
  wApp.Quit
   
  '// Open new mail 
  Set mdb = s.Getdatabase(s.Getenvironmentstring("MailServer", True), s.Getenvironmentstring("MailFile", True), False)
  Set doc = New NotesDocument(mdb) 
  doc.Form = "Memo"
  Set rt = doc.CreateRichTextItem("Body")
  Call rt.EmbedObject(Embed_Attachment, "", fpath, "test" )
  Call doc.Save(True, False) 
  Call ws.Editdocument(True, doc) 
  Call doc.RemoveItem("SaveOptions")
   
  '// Remove tmp file 
  Kill fpath 
End Sub





このスクリプトはフォーム上に配置し、ユーザーが文書の内容をすべて PDF としてメールできるようにするものです。ロジックは下記の通り。
- UI Doc を MS Word オブジェクトにコピーペーストする
- MS Word を PDF として保存する
- MS Word OLE オブジェクトを閉じる
- 新規メールと添付する PDF ファイルを開く
- 一時ファイルを削除する

LotusScript
katoman
August 18, 2015 at 11:05 AM
Rating
0





No comments yetLogin first to comment...