Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2018, 05:52 PM
Philipl411 Philipl411 is offline Is there a way to automate information into emails? Mac OS X Is there a way to automate information into emails? Office 2016 for Mac
Novice
Is there a way to automate information into emails?
 
Join Date: Jan 2018
Posts: 2
Philipl411 is on a distinguished road
Default Is there a way to automate information into emails?

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.
Reply With Quote
  #2  
Old 01-20-2018, 10:04 PM
gmayor's Avatar
gmayor gmayor is offline Is there a way to automate information into emails? Windows 10 Is there a way to automate information into emails? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 01-21-2018, 05:00 PM
Philipl411 Philipl411 is offline Is there a way to automate information into emails? Mac OS X Is there a way to automate information into emails? Office 2016 for Mac
Novice
Is there a way to automate information into emails?
 
Join Date: Jan 2018
Posts: 2
Philipl411 is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 01-21-2018, 10:34 PM
gmayor's Avatar
gmayor gmayor is offline Is there a way to automate information into emails? Windows 10 Is there a way to automate information into emails? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to automate information into emails? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft