Outlook Gurus, I have a question
Outlook Gurus, I have a question
I send out an email every Monday with an attachment that I update weekly. I have figured out by now to compose a message template that contains the same recipients, subject line, and body of the message. Is there a way to have the template automatically update the attachment? Outlook help is useless.
What I want to do is update the attachment on my desktop, open the message template, and send it off.
TIA
What I want to do is update the attachment on my desktop, open the message template, and send it off.
TIA
Something like this should work:
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" ' The mail body
.Display 'Show it
.OutlookAttach = .Attachments.Add("C:\test.txt")
End With
End Sub
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" ' The mail body
.Display 'Show it
.OutlookAttach = .Attachments.Add("C:\test.txt")
End With
End Sub
Originally Posted by vader716
Something like this should work:
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" ' The mail body
.Display 'Show it
.OutlookAttach = .Attachments.Add("C:\test.txt")
End With
End Sub
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" ' The mail body
.Display 'Show it
.OutlookAttach = .Attachments.Add("C:\test.txt")
End With
End Sub
Thanks though!
That's pretty sweet Vader. I write Macros for Excel all the time; have never thought of doing them in Outlook.
Trending Topics
Originally Posted by KSUWildcat
So your saying it looks like I'm better off deleting and attaching the old fashioned way. Had I a little more time to invest in Visual Basic, this would be the answer!
Thanks though!
Thanks though!
Originally Posted by KSUWildcat
So your saying it looks like I'm better off deleting and attaching the old fashioned way. Had I a little more time to invest in Visual Basic, this would be the answer!
Originally Posted by vader716
actually when you go into Outlook and macros...you should be able to code it yourself...you shouldnt need a full copy of VB
Originally Posted by UrbanCowboy
He said Time Vader not Money.
whats the big deal.....reading isnt that important anyways....
See I'm faking it over a cup of coffee
Actually looking at it a little more over lunch here, this isn't so bad.
Are you getting a 438 error regarding the attachment code? And why doesn't it generate a message everytime I run the macro?
Now how do I add my signature? Can I make a shortcut on my desktop to run this macro?
Are you getting a 438 error regarding the attachment code? And why doesn't it generate a message everytime I run the macro?
Now how do I add my signature? Can I make a shortcut on my desktop to run this macro?
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
'messageclass would load a form called test
.MessageClass = ("ipm.note.test")
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" & vbCr & vbCr & "Thank you," & vbCr & "Signature goes here" ' The mail body
.Attachments.Add ("C:\test.txt")
.Display 'Show it
End With
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
'messageclass would load a form called test
.MessageClass = ("ipm.note.test")
.To = "Test" 'Insert a name to be sent to
.Body = "My Text" & vbCr & vbCr & "Thank you," & vbCr & "Signature goes here" ' The mail body
.Attachments.Add ("C:\test.txt")
.Display 'Show it
End With
Try this
You can add a button by right clicking the toolbar, customize, macros, select the macro and drag it to the bar
Last edited by vader716; May 15, 2006 at 01:22 PM.
Sub Test()
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
'messageclass would load a form called test
.MessageClass = ("ipm.note.test")
.To = "Test" 'Insert a name to be sent to
.Attachments.Add ("C:\test.txt")
.HTMLBody = "<html><font color = #00B2EE body text='#00B2EE'> <b>text: <font color = #b90000><i><b>" & "</b></i></font><br>Comment: <font color = #00B2EE><i><b>" & "</b></i></font> <p>Thanks </body></html>"
.Display 'Show it
End With
End Sub
Dim objMail As Outlook.MailItem
Set objMail = Application.CreateItem(olMailItem)
With objMail
'messageclass would load a form called test
.MessageClass = ("ipm.note.test")
.To = "Test" 'Insert a name to be sent to
.Attachments.Add ("C:\test.txt")
.HTMLBody = "<html><font color = #00B2EE body text='#00B2EE'> <b>text: <font color = #b90000><i><b>" & "</b></i></font><br>Comment: <font color = #00B2EE><i><b>" & "</b></i></font> <p>Thanks </body></html>"
.Display 'Show it
End With
End Sub
Last edited by vader716; May 15, 2006 at 01:37 PM.
Oh Snap!
Thanks Vader, I have a very limited scope of programming.
add: I can't get both the HTML and "plain text" body to show at the same time.
nm, I got it.
Thanks Vader, I have a very limited scope of programming.
add: I can't get both the HTML and "plain text" body to show at the same time.
nm, I got it.
Last edited by KSUWildcat; May 15, 2006 at 01:47 PM.


