Sub Click(Source As Button)
Dim uiws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = uiws.CurrentDocument
Set doc = uidoc.Document
If Not uidoc.EditMode Then
uidoc.EditMode = True
End If
Dim sess As New NotesSession
Dim imagePath As String
Dim filters As String
filters = "JPG images|*.jpg|All files|*.*"
imagePath = getFilePath("c:/", "Get picture file",filters)
If imagePath = "" Then
Print "No picture selected"
Exit Sub
End If
' Function importPhoto assumes, that folder path is marked as "/"
Dim temp As String
temp = Replace(imagePath, "\", "/")
' NB! Document will be saved in function importPhoto
Call importPhoto(doc, temp, sess)
End Sub
' --- get file path
Function getFilePath(dirName As String, dialogTitle As String, filters As String) As String
' open file path dialog and return file path
' input: file directory
' output: file path
Dim ws As New NotesUIWorkspace
Dim fileName As Variant
getFilePath = "" ' seed function return with emtpy string
fileName = ws.OpenFileDialog( True, dialogTitle, filters, dirName)
If Not(Isempty(fileName)) Then
getFilePath = fileName(0)
End If
End Function
|