hi....
i did this form for sending emails...
the form consists of:
text boxex:
from, to , subject , attachment...
buttons:
send , forward, ...etc
when i fill the info and send the email it will go , but i don't know how to use the attachment , i have the browse button near the attachment box so the user can choose which file to attach but when i send it the attachment will not appear in the inbox.
can someone help me with the coding....
this is my code:
Code: ( text )
Option Explicit
Dim lPosition As Long
Private Sub cmdBack_Click()
If lPosition > 0 Then
lPosition = lPosition – 1
MAPIMessages1.MsgIndex = lPosition
txtFrom.Text = MAPIMessages1.MsgOrigDisplayName
txtTo.Text = MAPIMessages1.RecipDisplayName
txtSubject.Text = MAPIMessages1.MsgSubject
txtMessage.Text = MAPIMessages1.MsgNoteText
'txtAttach.Text = MAPIMessages1.Attachment
End If
End Sub
Private Sub cmdBrowse_Click()
Dim sFilenames() As String
Dim i As Integer
On Local Error GoTo Err_Cancel
With cmDialog
.FileName = ""
.CancelError = True
.Filter = "All Files (*.*)|*.*|HTML Files (*.htm;*.html;*.shtml)|*.htm;*.html;*.shtml|Images (*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif"
.FilterIndex = 1
.DialogTitle = "Select File Attachment(s)"
.MaxFileSize = &H7FFF
.Flags = &H4 Or &H800 Or &H40000 Or &H200 Or &H80000
.ShowOpen
' get the selected name(s)
sFilenames = Split(.FileName, vbNullChar)
End With
If UBound(sFilenames) = 0 Then
If txtAttach.Text = "" Then
txtAttach.Text = sFilenames(0)
Else
txtAttach.Text = txtAttach.Text & ";" & sFilenames(0)
End If
ElseIf UBound(sFilenames) > 0 Then
If Right$(sFilenames(0), 1) <> "\" Then sFilenames(0) = sFilenames(0) & "\"
For i = 1 To UBound(sFilenames)
If txtAttach.Text = "" Then
txtAttach.Text = sFilenames(0) & sFilenames(i)
Else
txtAttach.Text = txtAttach.Text & ";" & sFilenames(0) & sFilenames(i)
End If
Next
Else
Exit Sub
End If
Err_Cancel:
End Sub
Private Sub cmdClose_Click()
MAPISession1.SignOff
Unload Me
End Sub
Private Sub cmdForward_Click()
If lPosition < MAPIMessages1.MsgCount Then
lPosition = lPosition + 1
MAPIMessages1.MsgIndex = lPosition
txtFrom.Text = MAPIMessages1.MsgOrigDisplayName
txtTo.Text = MAPIMessages1.RecipDisplayName
txtSubject.Text = MAPIMessages1.MsgSubject
txtMessage.Text = MAPIMessages1.MsgNoteText
End If
End Sub
Private Sub cmdSend_Click()
'Start by telling the control that we are composing an e-mail
MAPIMessages1.Compose
MAPIMessages1.RecipDisplayName = txtTo.Text
MAPIMessages1.MsgSubject = txtSubject.Text
MAPIMessages1.MsgNoteText = txtMessage.Text
'MAPIMessages1.Attachment = txtAttach.Text
MAPIMessages1.ResolveName
MAPIMessages1.Send
End Sub
Private Sub Form_Load()
'Sign on to the MAPI Session
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch
End Sub
one more thing please
if i want to send to more than one person how can i do this?
because it only sends to one person
thank you