On Feb 21, 5:20 am, "Arno R" <arraNOcomS...@ tiscali.nlwrote :
Anybody has found a *real* solution for this ??
I really would like to *solve* this. (I know there are workarounds)
I offer these only because I think you may have advanced to the "try
anything" state.
1. Many years ago we (CDMA regulars) indentified that SendObject did
not work unless there is a (child) window visible in the Access
application window. That is, if we hide (not minimize) the database
window, and do not open any forms or reports, SendObject fails. But
the error message is not your error message. It's one in a hundred
that this might have something to do with you problem.
2. TTBOMK SendObject and all "sends" from Access depends upon MAPI and
its proper configuration. This code relies on mapi to open a draft
message in the default MAPI handler. I'm not suggesting this as a
workaround but it might be useful as a diagnostic. Perhaps you could
use it to ascertain that MAPI is OK on the client's computer, and what
the default handler for eml files is. This one's one in a thousand!
Private Declare Function ShellExecute& Lib "shell32.dl l" _
Alias "ShellExecu teA" _
( _
ByVal Window&, _
ByVal Operation$, _
ByVal File$, _
ByVal Parameters$, _
ByVal Directory$, _
ByVal Show&)
Public Sub Draft( _
ByVal from$, _
ByVal recipients$, _
ByVal subject$, _
ByVal body$, _
Optional ByVal cc$, _
Optional ByVal bcc$, _
Optional ByVal priority&)
Dim buffer$
Dim filenumber%
Dim filename$
Dim path$
On Error GoTo DraftErr:
buffer = "From:" & Chr(34) & from & Chr(34)
buffer = buffer & vbNewLine & "To:" & Chr(34) & recipients & Chr(34)
If Len(cc) 0 Then _
buffer = buffer & vbNewLine & "CC:" & Chr(34) & cc & Chr(34)
If Len(bcc) 0 Then _
buffer = buffer & vbNewLine & "BCC:" & Chr(34) & bcc & Chr(34)
buffer = buffer & vbNewLine & "Subject:" & Chr(34) & subject & Chr(34)
If priority < 1 Or priority 3 Then _
priority = 3
buffer = buffer & vbNewLine & "X_priority :" & priority
buffer = buffer & vbNewLine & "X_Unsent: 1"
buffer = buffer & vbNewLine
buffer = buffer & vbNewLine & body
path = Environ("temp")
filename = path & "\temp.eml"
' I doubt this line is necessary
' in VBA but it may be
' in languages where "\"
' is a literal precursor
filename = Replace(filenam e, "\", "/")
On Error Resume Next
Kill filename
On Error GoTo DraftErr:
filenumber = FreeFile()
Open filename For Binary As #filenumber
Put #filenumber, , buffer
Close #filenumber
ShellExecute 0, "Open", "file://" & filename, "", "", 0
DraftExit:
Close
Exit Sub
DraftErr:
With Err
MsgBox "Error Number " & .Number & vbNewLine & .Description, _
vbCritical, "Draft Creation Failed"
End With
Resume DraftExit
End Sub
Sub testDraft()
Draft "so*****@whatev er.com", "so*****@domain .com", _
"Draft", "This is a test."
End Sub