Email with Attachments
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Names of the attachements. The user selects the attachment they want to add to the email
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Absolutely!
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
How about this?
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
It works!!!! It gave me an error at first that said that the database was locked by another user. I closed it an reopened and it didn't give me the error again. Now I need to pull into the main DB. Pray it doesn't give me any grief so I can leave you alone! Thanks so much! I can't wait to study the code.
Leesha
Leesha
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
It ran form the main database!!! Thank you so very much!
Leesha
Leesha
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
Keep in mind that you or the end user will have to edit the EmailAttachments field, since it now uses your PC's path.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Gotcha! Thanks again!
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Hi Hans,
I've managed to add some formatting to what you built for me and have not blown it up! I am wondering if it is possible to format me.FirstName in the code below? If it's possible I'd like it to be Segoe Script in a 16 bold.
Thanks for everything!
Leesha
.Body = Me.Comment & vbCrLf & vbCrLf & vbCrLf & vbCrLf & Me.ClosingStatement & vbCrLf & vbCrLf & Me.FirstName
I've managed to add some formatting to what you built for me and have not blown it up! I am wondering if it is possible to format me.FirstName in the code below? If it's possible I'd like it to be Segoe Script in a 16 bold.
Thanks for everything!
Leesha
.Body = Me.Comment & vbCrLf & vbCrLf & vbCrLf & vbCrLf & Me.ClosingStatement & vbCrLf & vbCrLf & Me.FirstName
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
The .Body property is plain text.
If you want formatted text you can either use the .HTMLBody property or use Word to format the text.
The HTMLBody property requires HTML markup code:
.HTMLBody = "<body><font face=""Segoe Script"" size=""16pt""><b>" & Me.Comment & "<br><br><br><br>" & Me.ClosingStatement & "<br><br>" & Me.FirstName & "</b></font></body>"
If you want formatted text you can either use the .HTMLBody property or use Word to format the text.
The HTMLBody property requires HTML markup code:
.HTMLBody = "<body><font face=""Segoe Script"" size=""16pt""><b>" & Me.Comment & "<br><br><br><br>" & Me.ClosingStatement & "<br><br>" & Me.FirstName & "</b></font></body>"
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Hi Hans!
Thanks so much for the sample code. If I wanted only me.firstname to be in the Segoe Sript and the rest of the .Body to be in plain text is that possible and if so what would it look like?
Thanks!
Thanks so much for the sample code. If I wanted only me.firstname to be in the Segoe Sript and the rest of the .Body to be in plain text is that possible and if so what would it look like?
Thanks!
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
Try
.HTMLBody = "<body>" & Me.Comment & "<br><br><br><br>" & Me.ClosingStatement & "<br><br><font face=""Segoe Script"" size=""16pt""><b>" & Me.FirstName & "</b></font></body>"
.HTMLBody = "<body>" & Me.Comment & "<br><br><br><br>" & Me.ClosingStatement & "<br><br><font face=""Segoe Script"" size=""16pt""><b>" & Me.FirstName & "</b></font></body>"
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Hi Hans,
It does the same thing as the original one. It's OK. I am thrilled with what the original code. The user asked if there was any way to change the font for the first name but I'm sure they will live with it the way it is.
Thanks!
Leesha
It does the same thing as the original one. It's OK. I am thrilled with what the original code. The user asked if there was any way to change the font for the first name but I'm sure they will live with it the way it is.
Thanks!
Leesha
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Not to worry Hans, this is all working beautifully! My question is ............. is there a way to specify which email address it is coming from. One of the end users has a variety of email addresses based on the job she is performing. Right now the email goes out from her default email address. He wants to know if there is a way to pick a different email address within Access vs having to go to Outlook and change the default each time.
Thanks,
Leesha
Thanks,
Leesha
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Email with Attachments
Try adding
.SendUsingAccount = "account name"
To the code that creates the email
(replace account name with the full name of the account you want to use)
.SendUsingAccount = "account name"
To the code that creates the email
(replace account name with the full name of the account you want to use)
StuartR
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
Hi Stuart,
I tried the code but it still shows as coming from my default email in Outlook. I wasn't sure where to insert the code so put it after . body. Should it be elsewhere?
Thanks,
Leesha
I tried the code but it still shows as coming from my default email in Outlook. I wasn't sure where to insert the code so put it after . body. Should it be elsewhere?
Thanks,
Leesha
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
It should be before the line that displays or sends the message. Below the line that sets the body is fine. Try this:
substituting the desired email address.
Code: Select all
.SendUsingAccount = outApp.GetNameSpace("MAPI").Accounts("email address")
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1487
- Joined: 05 Feb 2010, 22:25
Re: Email with Attachments
I get an error that says wrong number of arguments or invalid property assignment.
-
- Administrator
- Posts: 78445
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Email with Attachments
Start Outlook and activate the Visual Basic Editor.
Select Insert > Module, then copy/paste the following code:
You should see the names of all your email accounts in the Ommediate window. Did you use one of those?
(You don't need to save changes to the VBA project in Outlook.
Select Insert > Module, then copy/paste the following code:
Code: Select all
Sub List()
Dim a As Account
For Each a In Session.Accounts
Debug.Print a.UserName
Next a
End Sub
(You don't need to save changes to the VBA project in Outlook.
Best wishes,
Hans
Hans