How to rename subject line and forward the email

Status
Not open for further replies.

chrisasir2

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi Diane,

I am reading emails from one subfolder called TEST and changing the subject text and then forwarding the emails to different recipient.
I wrote the VBA subroutine. Its not erroring out stating property is read only.

Kindly help me

---- Code

Sub Retrieve_subfolder_emails()

Dim olMail As MailItem
Dim ns As NameSpace

Dim olinboxfolder As MAPIFolder, olsubfolder As MAPIFolder
Dim msg As MailItem

Set ns = GetNamespace("MAPI")


Set olinboxfolder = ns.GetDefaultFolder(olFolderInbox)
Set olsubfolder = olinboxfolder.Folders("Test")

' Reading the mails from subfolder TEST

For Each msg In olsubfolder.Items
Set olMail = CreateItem(olMailItem)
With olMail
.To = "abcd@gmail.com"
.CC = ""
.Subject = "New subject Test1 :" & msg.Subject
.Body = msg.Body
.Attachments = msg.Attachments
.Send
End With
Set olMail = Nothing

Next msg

Set olsubfolder = Nothing
Set oinboxfolder = Nothing
Set ns = Nothing
End Sub




Regards,
Anand
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
N Rename Subject Line with Email Content Outlook VBA and Custom Forms 3
C Save outlook attachments and rename/append files with identifier from subject line Outlook VBA and Custom Forms 3
D VBA script to auto download attachments and rename file according to subject line Outlook VBA and Custom Forms 23
P Yahoo/IMAP folder rename by Outlook desktop 365 Using Outlook 0
M Outlook 365 Rename Outlook Priority Using Outlook 3
G Save and Rename Outlook Email Attachments Outlook VBA and Custom Forms 0
W Save and rename outlook email attachments to include domain name & date received Outlook VBA and Custom Forms 4
W Save Outlook attachment in network folder and rename to current date and time Outlook VBA and Custom Forms 18
D Autosave Attachment and Rename Outlook VBA and Custom Forms 1
F Rename Contacts Greyed Out Using Outlook 0
K IMAP Server Wants to alert you to the following: cannpt rename system folder Using Outlook 1
Diane Poremsky Rename Email Accounts and Data Files in the Folder List Using Outlook 0
S VBA code to rename a task (flagged message) Outlook VBA and Custom Forms 1
B Your IMAP server wants to alert you to the following: cannot rename system folders Using Outlook 8
L IMAP server wants to alert you to the following: cannot rename sytem folders Using Outlook 14
T Rename Outlook 2010 .PST Files Using Outlook 14
B IMAP server wants to alert you to the following cannot rename system folders Using Outlook 3
M Outlook Today. How to rename IMAP inbox accounts to something else than inbox? Using Outlook 4
A Rename resource Exchange 2003 Using Outlook 2
O Run Rule to Rename Email and Add to Tasks Using Outlook 4
M Rename Database BCM (Business Contact Manager) 1
J how do i rename the default fields in MS Business Contact manager BCM (Business Contact Manager) 1
H using VBA to edit subject line Outlook VBA and Custom Forms 0
F Auto changing email subject line in bulk Using Outlook 2
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
J Outlook 365 Forward Email Subject to my inbox when new email arrive in shared inbox Using Outlook 0
sjmo2 Change subject for new e-mails only. Outlook VBA and Custom Forms 2
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
D Prompt to prefix subject line whenever sending an email Outlook VBA and Custom Forms 3
ill13 Prepend the user's computer name to the subject. Outlook VBA and Custom Forms 1
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
2 How to get rid of the "Emailing:" prefix in the subject line Using Outlook 1
S Outlook Macro for [Date][Subject] Using Outlook 1
O How to find and replace a word in Outlook-Agenda-Subject and Message? Using Outlook 0
D ISOmacro to extract active mail senders name and email, CC, Subject line, and filename of attachments and import them into premade excel spread sheet Outlook VBA and Custom Forms 2
C Outlook 365 Subject Prefixes? Outlook VBA and Custom Forms 1
A Macro to file emails into subfolder based on subject line Outlook VBA and Custom Forms 1
N Save selected messages VBA does not save replies and/or messages that contain : in subject Outlook VBA and Custom Forms 1
V vBA for searching a cell's contents in Outlook and retrieving the subject line Outlook VBA and Custom Forms 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
M Outlook 2013 Script Assistance - Save Opened Link with Subject Added Outlook VBA and Custom Forms 1
B Add Prefix text to Subject Line Using Outlook 1
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 16
M Outlook 2013 Replace Subject with Conversation (a "hidden" value). Outlook VBA and Custom Forms 0
M Convert Subject Line to Internet Header version of Subject Outlook VBA and Custom Forms 10
M Adding Subject to this Link-Saving VBA Outlook VBA and Custom Forms 5
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8

Similar threads

Back
Top