Hi,
I am trying to custom made my MS outlook function, what i need is to have functions below to work in 1 time:
1) Reply all with attachment
2) Reply all with prefix/custom subject title.
I found both macros and tried by inserting them into outlook VBA, but it only works independently, means either 1st function work, or 2nd function work, or 1st work then 2nd work. But both cannot work parallel.
May i know who knows how to join/merge/combine the 2 macros into one, and make the functions into one by pressing only one ribbon in outlook?
Extra information:
Function 1 macros:
Sub ReplyWithAttachments()
Dim oReply As Outlook.MailItem
Dim oItem As Object
Set oItem = GetCurrentItem()
If Not oItem Is Nothing Then
Set oReply = oItem.Reply
CopyAttachments oItem, oReply
oReply.Display
End If
Set oReply = Nothing
Set oItem = Nothing
End Sub
Sub ReplyAllWithAttachments()
Dim oReply As Outlook.MailItem
Dim oItem As Object
Set oItem = GetCurrentItem()
If Not oItem Is Nothing Then
Set oReply = oItem.ReplyAll
CopyAttachments oItem, oReply
oReply.Display
End If
Set oReply = Nothing
Set oItem = Nothing
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function
Sub CopyAttachments(objSourceItem, objTargetItem)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldTemp = fso.GetSpecialFolder(2) ' TemporaryFolder
strPath = fldTemp.Path & "\"
For Each objAtt In objSourceItem.Attachments
strFile = strPath & objAtt.FileName
objAtt.SaveAsFile strFile
objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
fso.DeleteFile strFile
Next
Set fldTemp = Nothing
Set fso = Nothing
End Sub
Function 2 macros:
Sub CustomReply()
Set oOutlook = CreateObject("Outlook.Application")
Set oMail = CreateItem(Mail)
Set myReply = oMail.Actions("Reply").Execute
With myReply
Dim Reply As MailItem
.Subject = "release-authorised:"
.Display
End With
Set oMail = Nothing
Set oOutlook = Nothing
End Sub
Bookmarks