Updating Macro to OL2010/32bit

Status
Not open for further replies.

benjaminearle

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

I was forced to get a new OS (Win7/32) and new Outlook (2010 32bit) after my hard drive started threatening a catastrophic failure (click click beep beep beep).

I had a nifty macro in my old outlook that i re-installed in my new but it is not functioning completely.

For background, the only factory settings I have changed in OL are to attach an original when replying, replying to all or forwarding (to preserve attachments). I have enabled macros.

The macro should (did in Outlook 2003 and 2007):
1. Delete the original when replying, replying all, forwarding
2. Force a folder choice upon send

Item #2 is working, so I know the macro is at least trying to run. I assume some portion of the code just needs some 2010-style massaging. Any help would be greatly appreciated. This little tool has helped me keep my inbox under 100 items for years now. Very helpful since my inbox truncates, irretrievably at 30d age.

Macro:

' </DeleteOriginalWhenReply
Option Explicit

Private WithEvents ReplyButton As Office.CommandBarButton

Private WithEvents ForwardButton As Office.CommandBarButton

Private WithEvents ReplyAllButton As Office.CommandBarButton

Private WithEvents m_Inspectors As Outlook.Inspectors

Private m_Mail As Outlook.MailItem

Private Sub Application_Startup()
Set ReplyButton = Application.ActiveExplorer.CommandBars.FindControl(, 354)
Set ForwardButton = Application.ActiveExplorer.CommandBars.FindControl(, 356)
Set ReplyAllButton = Application.ActiveExplorer.CommandBars.FindControl(, 355)
Set m_Inspectors = Application.Inspectors

End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error Resume Next
If Not m_Mail Is Nothing Then
m_Mail.Delete
Set m_Mail = Nothing
End If

End Sub

Private Sub ReplyButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean _

)
On Error Resume Next
If TypeOf Application.ActiveWindow Is Outlook.Explorer Then
Set m_Mail = Application.ActiveExplorer.Selection(1)
Else
Set m_Mail = Application.ActiveInspector.CurrentItem
End If

End Sub

' </DeleteOriginalWhenReply
' </Assign Folder for Sent Messages
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem Then
Cancel = Not SaveSentMail(Item)
End If

End Sub

Private Function SaveSentMail(Item As Outlook.MailItem) As Boolean
Dim F As Outlook.MAPIFolder
If Item.DeleteAfterSubmit = False Then
Set F = Application.Session.PickFolder
If Not F Is Nothing Then
Set Item.SaveSentMessageFolder = F
SaveSentMail = True
End If
End If

End Function

' </Assign Folder for Sent Messages
Many many thanks and I hope once repaired this code can be useful to others as well. Both of these actions seem like things that could be factory-integrated into Outlook to reduce inbox size.

-Ben
 

benjaminearle

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
It should work in 2010 too. Put in some breakpoints and see if it hits them.

It's working in 2013 - even with inline compose (reading pane compose) and a lot of stuff won't work with it.

I'll fall on my pride sword here - breakpoints? I didn't write that original macro in it's entirety. It was originally only used for "reply" and i added "reply-all" and "forward". So, it was largely copy/paste (i'm good at that).

I'll do some searching for the breakpoint bit but if I don't post an update, i'd sure like some help.

Also, I have it all in one Project - VbaProject.OTM - ThisOutlookSession (Code) under Project1 just like i did in 2007. Did I need to split it up?

MacroWindow.jpg

-Ben
 

benjaminearle

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
It should work in 2010 too. Put in some breakpoints and see if it hits them.

It's working in 2013 - even with inline compose (reading pane compose) and a lot of stuff won't work with it.

OK, so i figured out the breakpoint thing (that's cool).

it appears to be skipping over these two lines:
m_Mail.Delete
Set m_Mail = Nothing

they have little breakpoint buttons next to them but it hops from
If Not m_Mail Is Nothing Then

to
End If

And, the mail remains undeleted.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I goofed when I tested it - it was not working in Outlook 2013. I dropped a note to the guy who owns the site where I presume you got the macro from (he has one like it posted in his collection) - it looks like it should work but he'll know if there is something changed in outlook 2010 that would affect it. He's in Germany, so it might be tomorrow before I hear back.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Michael said its because command bars aren't supported in 2010 and he's going to update his page tomorrow. (I think what he means is the inspector cant identify the message because of changes to the command bar support.)

the original code VBOffice - Samples
 

benjaminearle

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Michael said its because command bars aren't supported in 2010 and he's going to update his page tomorrow. (I think what he means is the inspector cant identify the message because of changes to the command bar support.)

the original code VBOffice - Samples

Thanks. I look forward to seeing the edited code.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Just heard from him - it looks like it won't be updated for 2010 due to the complexity that would be required to track the referenced item. Sorry.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Updating Last Modified Date on ThisOutlookSession Macro Outlook VBA and Custom Forms 1
D Custom Search Folders not refreshing/updating automatically Using Outlook 0
I Saving attachments from multiple emails and updating file name Outlook VBA and Custom Forms 0
G Updating VbaProject.OTM on several users Outlook VBA and Custom Forms 3
RBLampert Updating from Outlook 2010 to Outlook 365 Using Outlook 0
T Office 2013 no longer updating automatically Using Outlook 2
G Mass Updating Contact form used Outlook VBA and Custom Forms 8
J Updating existing entry on shared calendar wants to send update from delegate Using Outlook 0
K Can VBA intervene when updating Internet Calendars? Outlook VBA and Custom Forms 5
S Task Update coming as email and not updating task Using Outlook 3
M search takes a loooong time since updating Using Outlook 8
T Shared calendar not updating Using Outlook 1
T Need help with finding/updating task Outlook VBA and Custom Forms 1
TotallyConfused Godaddy Microsoft exchange 2007 stopped updating Exchange Server Administration 1
S Updating the database based on received task Outlook VBA and Custom Forms 3
makinmyway Recent Files Not Updating when Using Insert Hyperlink in Outlook 2013 Using Outlook 0
S Updating between Smartphone and PC Using Outlook 3
M Outlook 10 Inbox not updating Using Outlook 3
H Gmail not updating Outlook Home Using Outlook 17
Aalishaan Outlook 2010 Updating Inbox starts again Using Outlook 0
Alex Hall When updating shared calendar, it does not automatically update personal calendar Using Outlook 3
D Updating Registry to force new task and note items to save in a particular folder Using Outlook 1
K Excel Import Option: Need Help Updating Existing Records BCM (Business Contact Manager) 0
J Shared ICalendars are not updating in Outlook Using Outlook 2
A Updating Outlook Contact Phone Nos to international dialling codes Using Outlook 5
D Outlook 2010 - Pattern for updating task owner in generic mailbox Using Outlook 2
M Constantly updating address book Using Outlook 5
D Multiple Users Updating Custom Form At Same Time Using Outlook 1
M Updating VBA code from outlook 2007 to outlook 2010 Using Outlook 1
D Updating a recurring meeting cuses a reminder to be sent for every occurence. Using Outlook 2
C Message Count not updating Using Outlook 2
H Cannot share calendar, global address book not updating Exchange Server Administration 1
C Updating many contacts at once? BCM (Business Contact Manager) 3
Z Updating .ics files in OUtlook 2010 Using Outlook 1
J Outlook changing from inbox/trash/sent, etc. is EXTREMELY slow since updating Windows a couple of days ago. Is there an issue with Outlook as to the Using Outlook 2
H Calendar not updating accepted appointments! Using Outlook 1
D Updating Accounts in Business Contact Manager Using Outlook 1
S Global address book, 1 users not updating Using Outlook 2
S Error updating public folder with free/busy information on virtual machine server. The error number Using Outlook 2
K Updating Contact Groups in Outlook 2010 Using Outlook 3
T Error when updating Internet Calendar Subscriptions Using Outlook 12
R Outlook 2003 - Exchange 2010 global address list not updating Using Outlook 3
A Updating contacts with new information BCM (Business Contact Manager) 1
S Outlook calendar tracking not updating meeting acceptances Using Outlook 5
M updating and saving contacts in Distribution List Outlook VBA and Custom Forms 2
M Updating appointments from Access 07 Outlook VBA and Custom Forms 4
T Appoinments Not Updating after Outlook 2007 SP2 Outlook VBA and Custom Forms 1
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 1
witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7

Similar threads

Top