ttamilvanan81
New member
- Local time
- Tomorrow, 01:07
- Joined
- Mar 30, 2007
- Messages
- 6
Hai, i am new for this Forum.
Now am doing one Access Application. In my application i need to Send and Receive Email with Attachment.
Am complete the Sendmail, but without attachment.
If anybody know how to attach the file into the Email. I need the attachment as, Click the Browse button, to browse and select the file, the selected file path was stored in a text box. That file was stored into the Email.
Am using the following code for Send Email only.
In this code the attachment working as, we enter the whole file path manualy. But i need the Browse Button.
Private Sub Command20_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.Email_Address
.cc = Me.Cc_Address
.BCC = Me.bcc_Address
.Subject = Me.Mess_Subject
.HTMLBody = Me.Mess_Text
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
.Attachments.Add (Me.Mail_Attachment_Path)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send th note without storing it in your sent bin
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub
i know the Microsoft Common Dialog Control do this. But, If am try to put the Common Dialog Control into the Access Form, the following error message will occured.
You don't have the license required to use this ActiveX control.
You tried to open a form containing an OLE object or an ActiveX control or you tried to create an ActiveX control. To obtain the appropriate license, contact the company that provides the licensed OLE object or ActiveX control.
Then i goes and try to Register the Common Dialog Control with following method.
Then Am..
Go to the VBA Editor
Go to Tools - Referances - click Browse
Locate the activex file (comdlg32.ocx)
But still i have the same problem.
Any body help me for this. If anybody know how to solve this.. Plese let me know.
Thanks
Tamilvanan
Now am doing one Access Application. In my application i need to Send and Receive Email with Attachment.
Am complete the Sendmail, but without attachment.
If anybody know how to attach the file into the Email. I need the attachment as, Click the Browse button, to browse and select the file, the selected file path was stored in a text box. That file was stored into the Email.
Am using the following code for Send Email only.
In this code the attachment working as, we enter the whole file path manualy. But i need the Browse Button.
Private Sub Command20_Click()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = Me.Email_Address
.cc = Me.Cc_Address
.BCC = Me.bcc_Address
.Subject = Me.Mess_Subject
.HTMLBody = Me.Mess_Text
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
.Attachments.Add (Me.Mail_Attachment_Path)
End If
'.DeleteAfterSubmit = True 'This would let Outlook send th note without storing it in your sent bin
.Send
End With
'MsgBox MailOutLook.Body
Exit Sub
email_error:
MsgBox "An error was encountered." & vbCrLf & "The error message is: " & Err.Description
Resume Error_out
Error_out:
End Sub
i know the Microsoft Common Dialog Control do this. But, If am try to put the Common Dialog Control into the Access Form, the following error message will occured.
You don't have the license required to use this ActiveX control.
You tried to open a form containing an OLE object or an ActiveX control or you tried to create an ActiveX control. To obtain the appropriate license, contact the company that provides the licensed OLE object or ActiveX control.
Then i goes and try to Register the Common Dialog Control with following method.
Then Am..
Go to the VBA Editor
Go to Tools - Referances - click Browse
Locate the activex file (comdlg32.ocx)
But still i have the same problem.
Any body help me for this. If anybody know how to solve this.. Plese let me know.
Thanks
Tamilvanan
Last edited: