Newsgroup: it.comp.appl.access
Titolo: Inviare da codice VBA una e-mail con allegati usando Outlook Express

Sto utilizzando il codice in oggetto postato su sitocomune da Andrea 
Barchetti che ringrazio perchè erano mesi che tentavo di fare una cosa 
simile ma dovevo usare un client di terze parti perche' non con Oe non c'era 
verso di allegare file.
Ora per la serie "Perche' accontentarsi?" chiedo se qualcuno sa come si 
possa generare il nuovo messaggio da codice senza effettuarne l'invio, ma 
aprendo a video con outlook per eventuali modifiche o semplice controllo 
prima di confermarne alle spedizione manualmente.
Grazie e saluti a tutti.
Ale. 

 ha scritto nel messaggio
news:cuspih$v7b$1...@news.flashnet.it...

Il metodo sendobject contiene il parametro modificamessaggio che se true
permette di modificare il messaggio senza inviarlo. True è il valore di
default
Antonio

"Antonio Biso" <ch...@NOSPAMetruria.net> ha scritto nel messaggio
news:krmQd.33557$lB4.9...@twister1.libero.it...

Grazie per la risposta ma non viene usato il metodo sendobject, posso
supporre che la soluzione si annidi nelle costanti, ma senza conoscere il
significato delle declarations della libreria msoe.dll la vedo dura:
Public Declare Function MAPISendMail Lib "c:\programmi\outlook
express\msoe.dll" (ByVal Session As Long, _
ByVal UIParam As Long, ByRef message As MAPIMessage, ByVal Flags As Long,
ByVal Reserved As Long) As Long
Private Const MAPI_E_NO_LIBRARY = 999
Private Const MAPI_E_INVALID_PARAMETER = 998
Private Const MAPI_ORIG = 0
Private Const MAPI_TO = 1
Private Const MAPI_CC = 2
Private Const MAPI_BCC = 3
Private Const MAPI_UNREAD = 1
Private Const MAPI_RECEIPT_REQUESTED = 2
Private Const MAPI_SENT = 4
Private Const MAPI_LOGON_UI = &H1
Private Const MAPI_NEW_SESSION = &H2
Private Const MAPI_DIALOG = &H8
Private Const MAPI_UNREAD_ONLY = &H20
Private Const MAPI_ENVELOPE_ONLY = &H40
Private Const MAPI_PEEK = &H80
Private Const MAPI_GUARANTEE_FIFO = &H100
Private Const MAPI_BODY_AS_FILE = &H200
Private Const MAPI_AB_NOMODIFY = &H400
Private Const MAPI_SUPPRESS_ATTAch = &H800
Private Const MAPI_FORCE_DOWNLOAD = &H1000
Private Const MAPI_OLE = &H1
Private Const MAPI_OLE_STATIC = &H2
Sarebbe utile anche un link su dove trovare documentazione, con google non 
ho trovato granche'.
Grazie.
Ale.


Prova questo:
Option Compare Database
Option Explicit
Type MAPIMessage
   Reserved As Long
   Subject As String
   NoteText As String
   MessageType As String
   DateReceived As String
   ConversationID As String
   flags As Long
   RecipCount As Long
   FileCount As Long
End Type
Type MapiRecip
   Reserved As Long
   RecipClass As Long
   Name As String
   Address As String
   EIDSize As Long
   EntryID As String
End Type
Type MapiFile
   Reserved As Long
   flags As Long
   Position As Long
   PathName As String
   FileName As String
   FileType As String
End Type
Global Dialogue As MAPIMessage
Declare Function MAPISendMailOE _
                 Lib "C:\Program Files\Outlook Express\Msoe.dll" _
                 Alias "BMAPISendMail" _
                 (ByVal Session&, _
                  ByVal UIParam&, _
                  Message As MAPIMessage, _
                  Recipient() As MapiRecip, _
                  File() As MapiFile, _
                  ByVal flags&, _
                  ByVal Reserved&) As Long
Declare Function MAPISendMail _
                 Lib "MAPI32.DLL" _
                 Alias "BMAPISendMail" (ByVal Session&, _
                 ByVal UIParam&, _
                 Message As MAPIMessage, _
                 Recipient() As MapiRecip, _
                 File() As MapiFile, _
                 ByVal flags&, _
                 ByVal Reserved&) As Long
Global Const SUCCESS_SUCCESS = 0
Global Const MAPI_TO = 1
Global Const MAPI_CC = 2
Global Const MAPI_CCO = 3
Global Const MAPI_LOGON_UI = &H1
Global Const MAPI_DIALOG = &H8
Function SendMail(sSubject As String, _
                  sTo As String, _
                  sCC As String, _
                  sCCO As String, _
                  sAttach As String, _
                  sMessage As String, _
                  Optional sImmediateSend As Boolean = True) _
                  As Long
   Dim MAPI_Message As MAPIMessage
   Dim i As Integer
   Dim cTo As Integer
   Dim cCC As Integer
   Dim cCCO As Integer
   Dim cAttach As Integer
   cTo = CountWords(sTo, ";")
   cCC = CountWords(sCC, ";")
   cCCO = CountWords(sCCO, ";")
   cAttach = CountWords(sAttach, ";")
   ReDim rTo(0 To cTo) As String
   ReDim rCC(0 To cCC) As String
   ReDim rCCO(0 To cCCO) As String
   ReDim rAttach(0 To cAttach) As String
   ParseWords rTo(), sTo, ";"
   ParseWords rCC(), sCC, ";"
   ParseWords rCCO(), sCCO, ";"
   ParseWords rAttach(), sAttach, ";"
   ReDim MAPI_Recip(0 To cTo + cCC + cCCO - 1) As MapiRecip
   For i = 0 To cTo - 1
      MAPI_Recip(i).Name = rTo(i)
      MAPI_Recip(i).RecipClass = MAPI_TO
   Next i
   For i = 0 To cCC - 1
      MAPI_Recip(cTo + i).Name = rCC(i)
      MAPI_Recip(cTo + i).RecipClass = MAPI_CC
   Next i
   For i = 0 To cCCO - 1
      MAPI_Recip(cTo + cCC + i).Name = rCCO(i)
      MAPI_Recip(cTo + cCC + i).RecipClass = MAPI_CCO
   Next i
   ReDim MAPI_File(0 To cAttach) As MapiFile
   MAPI_Message.FileCount = cAttach
   For i = 0 To cAttach - 1
      MAPI_File(i).Position = -1
      MAPI_File(i).PathName = rAttach(i)
   Next i
   MAPI_Message.Subject = sSubject
   MAPI_Message.NoteText = sMessage
   MAPI_Message.RecipCount = cTo + cCC + cCCO
    If sImmediateSend = True Then
        Dialogue.flags = MAPI_LOGON_UI
    Else
        Dialogue.flags = MAPI_LOGON_UI + MAPI_DIALOG
    End If
  Select Case GetDefaultMailSoftware() 'Fonctions API disponibles ici
  Case "Outlook Express"
      SendMail = MAPISendMailOE(0&, 0&, _
                                MAPI_Message, _
                                MAPI_Recip(), _
                                MAPI_File(), _
                                Dialogue.flags, 0)
  Case "Microsoft Outlook", "Outlook"
      SendMail = MAPISendMail(0&, 0&, _
                                MAPI_Message, _
                                MAPI_Recip(), _
                                MAPI_File(), _
                                Dialogue.flags, 0)
  Case Else
      MsgBox "Votre client de messagerie n'est pas supporté"
  End Select
End Function
Function CountWords(ByVal sSource As String, _
                    ByVal sDelim As String) _
                    As Integer
Dim iDelimPos As Integer
Dim iCount As Integer
 If sSource = "" Then
    CountWords = 0
 Else
    iDelimPos = InStr(1, sSource, sDelim)
    Do Until iDelimPos = 0
        iCount = iCount + 1
        iDelimPos = InStr(iDelimPos + 1, sSource, sDelim)
    Loop
        CountWords = iCount + _
                     IIf(Right(sSource, 1) = sDelim, 0, 1)
 End If
End Function
Function GetWords(sSource As String, _
                  ByVal sDelim As String) _
                  As String
	Dim iDelimPos As Integer
	iDelimPos = InStr(1, sSource, sDelim)
    If (iDelimPos = 0) Then
        GetWords = Trim$(sSource)
        sSource = ""
    Else
        GetWords = Trim$(Left$(sSource, iDelimPos - 1))
        sSource = Mid$(sSource, iDelimPos + 1)
    End If
End Function
Sub ParseWords(mArray() As String, _
               ByVal sTokens As String, _
               ByVal sDelim As String)
	Dim i As Integer
	For i = LBound(mArray) To UBound(mArray)
    	mArray(i) = GetWords(sTokens, sDelim)
	Next i
End Sub
-- 
@Alex (Alessandro Baraldi)
---------------------------------------------------------------------------
http://www.sitocomune.com/
http://www.mantuanet.it/alessandro.baraldi/
---------------------------------------------------------------------------

 Prova questo:
FANTASTICO!
ho solo dovuto forzare l'uso di OE in quanto anche con l'aggiunta delle 
functions mancanti GetDefaultMailAccount() e fReturnRegKeyValue, non so 
perchè ma non riuscivo ad ottenere da registri il mailer predefinito, mi 
ritornava null forse un problema di diritti su w2k server, va benissimo 
anche così.
Grazie infinite.
Ale.