Hi everyone!
I’ve made an action button, which makes scans a document (through TWAIN), and (…must do…) places it’s image to a “Scan” field. But: when I try to rtff.EmbedObject I cannot see the file attachment. Furthermore, when I save a doc, I can see a $FILE and $OLEOBJINFO properties in a doc, but I still cannot see the attachment!
What’s wrong?
The scanning code is:
Sub Click(Source As Button)
Const SCANFILEPATH$={C:\temp\doc.jpg}
Const IMPORTFILETYPE$={JPEG}
Const RTFNAME$={Scan}
Const SCANOBJNAME$={Kodak Image Scan Control}
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim scanner As Variant
Dim db As notesdatabase
Dim s As New notessession
Dim doc As notesdocument
Dim fileTemp As String
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.document
Set db = s.currentdatabase
Call uidoc.GoToField(“Scan”)
On Error Resume Next
Set scanner = uidoc.GetObject(“Kodak Image Scan Control”)
scanner.MultiPage = 1
If scanner.ScannerAvailable=False Then
Messagebox "Сканнер не доступен!"
Else
' scanner.ShowSelectScanner
scanner.image=SCANFILEPATH$
scanner.ScanTo=2
scanner.PageOption=6
Call scanner.SetPageTypeCompressionOpts(3, 5, 8, 24124)
scanner.ShowSetupBeforeScan=True
scanner.OpenScanner
scanner.StartScan
Call scanner.CloseScanner
Dim rtff As Variant 'NotesRichTextItem
Set rtff = uidoc.Document.GetFirstItem("Scan")
If ( rtff.Type = RICHTEXT ) Then
Call rtff.EmbedObject(EMBED_ATTACHMENT, "", SCANFILEPATH$)
Call uidoc.Document.Save(True, False)
Call uidoc.Refresh
End If
End If
End Sub
Thanks in advance,
Dmitry.
P.S. By the way, when I use CreateObject instead of EmbedObject, it works ok, in sense that it places a 2Megabyte image to a scan field (instead of 80K attached file)…