Copy email from preview pane with headers

Status
Not open for further replies.

jlibs804

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hello,

My first post but I've been reading this forum and slipstick for a few weeks now. Through that and other sites I've come up with this VBA which allows me to copy an email directly from the preview window with headers.

Code:
Sub copyall()
Dim m As MailItem
Dim cb As Object
Set m = ActiveExplorer().Selection.Item(1)
tmp = "c:\temp\mytest.txt"   'any filename as long as it does not overwrite some wanted file
Set m = m.Forward
m.SaveAs tmp, 0
m.Close olDiscard
Open tmp For Input As 1
mymsg = Input(LOF(1), #1)
Close 1
Kill tmp
Set cb = CreateObject("clipbrd.clipboard")
cb.Clear
cb.SetText CStr(mymsg)
End Sub

My problem is that when I paste the email the first 12 lines are not needed which include a Subject line, an Include line, then a few blank lines and then 7 lines for my signature. I'm manually removing these lines but am trying to customize the VBA above to do that for me. Or come up with another approach. I seem to be struggling either way. Can anyone put me in the right direction?
 

jlibs804

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thanks for the reply Diane. I would have two questions regarding that approach; 1.) Would that still give me the headers so that my copy essentially looks like this (below). 2.) How would I go about copying form the original message?
Code:
From: Smith, Kelly
Sent: Tuesday, December 02, 2014 4:16 PM
To: Davis, John
Cc:
Subject: RE: ABC Proposal #Z6372 - Install - Remote Training (8 estimated hours) to Include: Website

Let’s close out the ticket and I will make sure we just bill the 7 hours.  We can quote again later if or
when they decide to move forward.

Kelly Smith
  Administrative Services Manager
  ABC, Inc.
12345 Gerburry Rd. Suite 100
Austin  TX 64428
P: (555) 860-2559 ext. 311
F: (555) 754-4460
ksmith@abc.com
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
When i commented out the forward line in your code, it was formatted just like your sample.

Code:
From:    display name <address>
Sent:    Wednesday, August 20, 2014 9:17 AM
To:    name
Subject:    Re: subject

message
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Z Copy specific email body text Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2
Z VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
Stilgar Relsik Create a rule to copy text from an email and paste it in the subject line. Using Outlook 1
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
G VBA Copy draft email to a new email - attachments not copided Using Outlook 7
C Copy email to excel runtime error 5020 Using Outlook 5
I Copy email from folder to folder - FAILS Using Outlook 5
Q Why can't I copy image with embedded hyperlink from email to Word Using Outlook 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
L Copy email body fields to excel Using Outlook 0
C Copy Cell value from Excel and paste into current email Outlook VBA and Custom Forms 10
D How to copy yahoo email folders to hard drive Using Outlook 2
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
Mary B Outlook 2013: Rule for copying new email to folder & marking that copy as read Using Outlook 1
S VBA to identify a specific email and copy the attachment from it to the network Outlook VBA and Custom Forms 4
L Outlook 2007 Copy Email Address in To Field Using Outlook 11
Aussie Looking for Outlook macro to Copy Recipient Names into Email Body Outlook VBA and Custom Forms 3
A Macro to copy email body to new email Outlook VBA and Custom Forms 5
P Copy email address from outlook 2013/2010 Using Outlook 1
M Copy "To" Address Value from a Newly Created Email to the "To" Address Field of Custom Form Using Outlook 4
O Copy email content and paste into new Word Document using a different font Using Outlook 1
R Macro to copy email address Using Outlook 6
A Copying cc email addresses to Excel - does not copy the <joe.bloggs@isp.com> Using Outlook 1
R how to copy a list of email contacts and paste them only as names (not names + email address) Using Outlook 12
B Mark copy of sent email as read - VBA? Outlook VBA and Custom Forms 3
R Sending a copy of an incoming email to a network folder Outlook VBA and Custom Forms 1
K Copy Entire Email Content - Paste into new Task Outlook VBA and Custom Forms 2
C Copy email to different folder, works in 2003 but not 2007 Outlook VBA and Custom Forms 3
S Using copy paste to grab email addresses from the TO: address fiel Using Outlook 14
O In Agenda-view - How to copy an existing item months ahead or back? Using Outlook 0
C Move or copy from field to field Outlook VBA and Custom Forms 0
O Outlook 365 - How to create / copy a new contact from an existing one? Using Outlook 5
S Copy Tasks/Reminders from Shared Mailbox to Personal Tasks/Reminders Outlook VBA and Custom Forms 0
A Cannot copy this folder because it may contain private items Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
Commodore Move turns into "copy" Using Outlook 3
C Copy Outlook contact field value to another field Outlook VBA and Custom Forms 1
J Copy to calendar function no longer working in outlook 365 Using Outlook 5
F Copy and replace not update contact in another pst Using Outlook 0
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0
K Outlook Rules: Move a Copy Using Outlook 4

Similar threads

Top