Jump to content
Macro Express Forums

Semi automatically create an Oulook email message with attachement (help needed)


hrodgar

Recommended Posts

Hi,

 

I am new to this forum and disvovered ME in the last 12 hours.

 

FYI: I think that Macro Express is really great and I have already thrown out of the door Autohotkey and TypePilot since I finally discovered a utility that is omnifunctional :-)

 

However I am not a programmer and hope that someone can help me. I have been looking to find an answer on the forum but have not found it (but it might be posted though).

 

My objective is that I need to send regularly an E-mail (e.g. after a training) with a copy of some slides attached. This is always the same process and I want to automate this as much as possible. So here is what I am looking for:

 

Create an Email in Outlook 2007 with :

1) a predefined subject line (either: "Slides training ABC enclosed" or "Slides training XYZ enclosed")

2) a predefined body ("Please find enclosed the slides for training ABC" or "Please find enclosed the slides for training XYZ")

3) automatically attach 2 files "D:\Data\SlidesABC.pdf" and "D:\Data\Evaluation.doc" to each Email

 

I want this to happen (normally when I am in Outlook) by hitting a shortcut key and by answering one question (ideally a radio button or drop down) from ME that says "training ABC or training XYZ?".

 

The only thing for me to do would then to add some extra text if needed to the email, add the recipient's email address and hit the send button.

 

Can someone point me in the right direction?

 

I am willing to pay some nominal fee (PayPal) if this is complicated to do.

 

Many thanks,

 

Hrodgar

Link to comment
Share on other sites

Hi,

 

I am new to this forum and disvovered ME in the last 12 hours.

 

FYI: I think that Macro Express is really great and I have already thrown out of the door Autohotkey and TypePilot since I finally discovered a utility that is omnifunctional :-)

 

However I am not a programmer and hope that someone can help me. I have been looking to find an answer on the forum but have not found it (but it might be posted though).

 

My objective is that I need to send regularly an E-mail (e.g. after a training) with a copy of some slides attached. This is always the same process and I want to automate this as much as possible. So here is what I am looking for:

 

Create an Email in Outlook 2007 with :

1) a predefined subject line (either: "Slides training ABC enclosed" or "Slides training XYZ enclosed")

2) a predefined body ("Please find enclosed the slides for training ABC" or "Please find enclosed the slides for training XYZ")

3) automatically attach 2 files "D:\Data\SlidesABC.pdf" and "D:\Data\Evaluation.doc" to each Email

 

I want this to happen (normally when I am in Outlook) by hitting a shortcut key and by answering one question (ideally a radio button or drop down) from ME that says "training ABC or training XYZ?".

 

The only thing for me to do would then to add some extra text if needed to the email, add the recipient's email address and hit the send button.

 

Can someone point me in the right direction?

 

I am willing to pay some nominal fee (PayPal) if this is complicated to do.

 

Many thanks,

 

Hrodgar

 

Hi Hrodgar,

 

Unfortunatelly, I don't know the solution of your problem, but the Tutorial can help you. (Use index sheet and type email and read those entries.)

 

 

 

thomas

Link to comment
Share on other sites

It's very easy to do this once you know the basics of MacroExpress. I'd suggest studying the help file and practising using commands such as text type and program launch. This is one of my macros that does something similar to what you want:

 

Variable Set String %T1% from File: "Time log account manager.txt"

Replace "&" with "" in %T1%

Variable Modify String: Copy %T1% to %T4%

Variable Set String %T2% from File: "Time log customer.txt"

Variable Set String %T3% from File: "Time log job number.txt"

Variable Set Integer %N1% from Position of Text in Variable %T4%

Variable Modify String: Delete Part of %T4%

Program Launch: "OUTLOOK.EXE"

Wait For Window Title: "- Microsoft Outlook"

Text Type: <CTRLD>1<CTRLU>

Wait Time Delay 1 Seconds

Text Type: <CTRLD>n<CTRLU>

Wait For Window Title: "Untitled - Message (HTML) "

Wait Time Delay 1 Seconds

Text Type: %T1%

Text Type: <TAB><TAB>

Delay 200 Milliseconds

Text Type: <TAB>

Delay 200 Milliseconds

Text Type: %T2% %T3%

Text Type: <TAB>

Delay 200 Milliseconds

Text Type: Hi %T4%,

(message body)

 

 

<TVAR2:01:04:H:\Text file variables\Time log\Time log account manager.txt><TMVAR2:21:01:01:001:000:&><TMVAR2:09:04:01:000:000:><TVAR2:02:04:H:\Text file variables\Time log\Time log customer.txt><TVAR2:03:04:H:\Text file variables\Time log\Time log job number.txt><IVAR2:01:13:4: ><TMVAR2:11:04:00:N01:010:><LAUNCHDEL2:0:01C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE><WAITWIN2:000010:000000:- Microsoft Outlook><TEXTTYPE:<CTRLD>1<CTRLU>><TDELAY:1><TEXTTYPE:<CTRLD>n<CTRLU>><WAITWIN2:000010:000000:Untitled - Message (HTML) ><TDELAY:1><TEXTTYPE:%T1%><TEXTTYPE:<TAB><TAB>><MSD:200><TEXTTYPE:<TAB>><MSD:200><TEXTTYPE:%T2% %T3%><TEXTTYPE:<TAB>><MSD:200><TEXTTYPE:Hi %T4%,
(message body)
>

Link to comment
Share on other sites

  • 2 weeks later...

For the outlook thing, make sure you check out "command line switches" in Outlook.

THis is an advanced feature Outlook has where you can create a new email *without* having to wait for the entire OL application to load. In Window this can only be used in a Run command (?), but MacExp can use it too.

 

I'll try to paste a script I made...

(Note: this is the Outlook 2007 version of a 2003 "make to do" macro that I emailed to the site, i.e. "user-contrbuted")

 

 

 

<REM2:Get Date and set to T2><TEXTTYPE:<SHIFTD><ARROW UP><SHIFTU>><CLIPT><TVAR2:02:03:><REM2:Get To Do and set to T1><TEXTTYPE:<SHIFTD><ARROW UP><SHIFTU>><CLIPT><TVAR2:01:03:><REM2:Make a new Outlook Task><LAUNCHDEL2:0:01C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE<PARAM>/c ipm.task><REM2:Go to and paste to Subject.><TEXTTYPE:<ALTD>u<ALTU>%T1%><REM2:Go to and paste to Date.><TEXTTYPE:<ALTD>d<ALTU><DELETE>%T2%><REM2:Save and close Task><TEXTTYPE:<ALTD>hav<ALTU>>

 

I recomend making it "global" triggered by a hotkey.

The directions are thus:

 

BEGIN

Directions must be followed exactly:

1. Type into some text field a task item and hit Enter (carriage return).

2. Type a due date (in a format that Outlook will recognized) and hit enter.

3. Activate the macro.

 

What you have should look like this:

=====================================

Blah blah some writing I'm doing or taking notes at a meeting yadda yadda.

Then I suddenly remember I need to buy milk tomorrow...

Buy milk

2-6-08

X

=====================================

Where "X" is the position of the cursor when the Macro is activated.

 

Note: This uses an Outlook Command-Line Switch. It's been tested on Outlook 2007.

Also note: A previous version of this was made for Outlook 2003. THe command switches of 03 vs. 07 are the same, but the shortcut letters are different.

 

Please treat this script as "open source."

-kunkel321

END

 

PS: For making an email, change the switch to from "ipm.task" to "ipm.note"

Hope this helps :) -steve

Link to comment
Share on other sites

  • 3 months later...

You might have an easier time using VBA, which is built in to Outlook...

 

Here are examples of macros you could place in an Outlook module (Tools\Macros\Visual Basic Editor):

 

VBA CODE:

 

Sub SlidesTrainingABC()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add("Smith, John")
myItem.Subject = "Slides Training ABC"
Set myAttachments = myItem.Attachments
myAttachments.Add "D:\Data\SlidesABC.pdf", _
	olByValue, 1, "SlidesABC"
myAttachments.Add "D:\Data\Evaluation.doc", _
	olByValue, 1, "Evaluation"
myItem.Display
End Sub

Sub SlidesTrainingXYZ()
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add("Smith, John")
myItem.Subject = "Slides Training XYZ"
Set myAttachments = myItem.Attachments
myAttachments.Add "D:\Data\SlidesXYZ.pdf", _
	olByValue, 1, "SlidesXYZ"
myAttachments.Add "D:\Data\Evaluation.doc", _
	olByValue, 1, "Evaluation"
myItem.Display
End Sub

Then you could add shortcut buttons to your Outlook tool bar like this:

 

Tools\Customize : Commands Tab

 

Categories: Macros

 

Drag and drop each macro to the toolbar. You can then right-click on it and change the name, icon, etc...

 

If not, you could try doing something like this with ME:

 

<MENU2:2:T:51:CenterCenter:Send Report:Which report would you like to send?Slides Training ABC
Slides Training XYZ><REM2:Based on which select you picked, that Outlook Template is opened later on><IFVAR2:1:51:1:A><REM2:Set T50 to "Slides_Training_ABC.oft"><TVAR2:50:01:C:\Documents and Settings\%username%\Application Data\Microsoft\Templates\Slides_Training_ABC.oft><ENDIF><IFVAR2:1:51:1:B><REM2:Set T50 to "Slides_Training_XYZ.oft"><TVAR2:50:01:C:\Documents and Settings\%username%\Application Data\Microsoft\Templates\Slides_Training_XYZ.oft><ENDIF><LAUNCHDEL2:0:01%T50%><REM2:Attach file(s)>

Just create two Outlook e-mail templates and place them in the standard template location. Then ME will prompt you for which one you'd like to open... you'll just need to add the code to attach the files.

 

Hope that helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...