![]() |
|
#1
|
|||
|
|||
|
The group that I work in has to to send out several email a day and each mail will need us to cut and paste information from a previous email. This can take up to 45 minutes per email. I am hoping to find a way to help lower user error. I am wanting to be able to set user defined fields so that is the wrong information is entered the program will not let you send the email out. For example, If I am sending an email to our austin office, I would like the email to automatically insert "Hello Austin Team," There is also things like room number I have to insert, time and dates, who will be at meeting.
|
|
#2
|
||||
|
||||
|
The short answer is yes and had this been a PC based version of Office, it would have been fairly easy to achieve using a template that contains all the fixed content and a macro to supply the various pieces of variable data. Unfortunately I don't know enough about the Mac version to advise what is possible there. Macros intended for the PC often don't work with the MC.
It would also be possible on a PC to create the message template in Word, fill it there and send the resulting document by e-mail. That might be a way forward that doesn't require any programming skills.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
That is not a problem. My office computers are Windows and I also run Parallels on my mac so I have windows 10 on my mac
|
|
#4
|
||||
|
||||
|
To show the principles involved, from Outlook, create a message that contains some text and four bookmarked locations bmTest1 to bmTest4. Save it as a template called 'Bookmark Test.oft'.
Then create the following macro in a new VBA module. Change the template path as appropriate. Then run the macro. It will create a new message based on the template and fill the four named bookmarks with the four values indicated. In practice you would collect the values from a userform http://www.gmayor.com/Userform.htm or from some other location, but this post is just to demonstrate the basics. Code:
Option Explicit
Sub CreateMessageWithBM()
Dim olItem As MailItem
Dim olEmail As Outlook.MailItem
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim vBM As Variant
Dim i As Long, j As Long
Dim strBMText As String
Const strBookmarks As String = "bmTest1|bmTest2|bmTest3|bmTest4"
vBM = Split(strBookmarks, "|")
Set olItem = CreateItemFromTemplate("D:\Word 2016 Templates\Bookmark test.oft")
With olItem
.BodyFormat = olFormatHTML
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
.Display
For j = 0 To UBound(vBM)
Select Case j
Case Is = 0: strBMText = "This is the value for bookmark 1"
Case Is = 1: strBMText = "This is the value for bookmark 2"
Case Is = 2: strBMText = "This is the value for bookmark 3"
Case Is = 3: strBMText = "This is the value for bookmark 4"
End Select
FillBM wdDoc, CStr(vBM(j)), strBMText
Next j
End With
lbl_Exit:
Exit Sub
End Sub
Private Sub FillBM(odoc As Object, strbmName As String, strValue As String)
'Graham Mayor - http://www.gmayor.com
Dim oRng As Object
With odoc
On Error GoTo lbl_Exit
Set oRng = .Bookmarks(strbmName).Range
oRng.Text = strValue
oRng.Bookmarks.Add strbmName
End With
lbl_Exit:
Set oRng = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Automate repeating text
|
tchav | Word | 3 | 04-18-2016 04:17 AM |
| Can I automate an email by category | brandy | Outlook | 1 | 01-08-2013 11:55 AM |
| How to automate all slides | Pemberton | PowerPoint | 1 | 11-09-2011 04:39 PM |
| Looking for a way to automate moving emails to folder | middletree | Outlook | 1 | 09-28-2010 01:24 PM |
| Automate Excel tabname | deegz | Excel | 2 | 12-08-2008 02:57 AM |