After Office 2007 SP2 install - Outlook 2007 macro no longer worki

  • Thread starter Thread starter cnByYXRpa25v
  • Start date Start date
Status
Not open for further replies.
C

cnByYXRpa25v

Hi guys,

I have a macro that will move all email sent with "sendonbehalf" properties

to the group mailbox. I found it on someone post and it has been working like

a charm until I installed Office SP2. It doesn't work anymore. Do anyone

might know what is the issue? I have try re-install Office then also SP2 with

no joy.

Below is the code

Private SentEntryID As String

Private SentStoreID As String

Private WithEvents objSentItems As Items

Private MailItem As Outlook.MailItem

Public Sub Application_Startup()

'Retrieve ID for accessing non-default sent folder

getStoreFolderID ("Mailbox - group")

Set objSentItems =

Application.Session.GetDefaultFolder(olFolderSentMail).Items

End Sub

Function getStoreFolderID(StoreName)

'Gets the Shared Account Sent Folder

Dim Store As Object

Dim StoreFolder As Object

Dim i As Integer

Set Store = Application.GetNamespace("mapi").Folders

For Each StoreFolder In Store

If StoreFolder.Name = StoreName Then

For i = 1 To StoreFolder.Folders.Count

If StoreFolder.Folders(i).Name = "Sent Items" Then

SentEntryID = StoreFolder.Folders(i).EntryID

SentStoreID = StoreFolder.Folders(i).StoreID

Exit For

End If

Next

Exit For

End If

Next

Set Store = Nothing

Set StoreFolder = Nothing

End Function

Private Sub objSentItems_ItemAdd(ByVal Item As Object)

'Fired when something is added to personal "Sent Mail" folder

If TypeOf Item Is Outlook.MailItem Then

With Item

Set MailItem = Application.GetNamespace("mapi").GetItemFromID(.EntryID,

> .Parent.StoreID)

End With

If MailItem.SentOnBehalfOfName = "group" Then

Set DestinationFolder = Application.Session.GetFolderFromID(SentEntryID,

SentStoreID)

MailItem.Move (DestinationFolder)

End If

End If

Set MailItem = Nothing

End Sub

Any suggestion or thinking are welcomed.

Thanks.
 
Doesn't work in what way? Does the code run at all? What if you run it

manually, do you get any errors? Which line or lines throw errors?

"rpratikno" <rpratikno> wrote in message

news:D47D1D48-7EEF-4C05-9F04-073BC1AEBF63@microsoft.com...
> Hi guys,

> I have a macro that will move all email sent with "sendonbehalf"
> properties
> to the group mailbox. I found it on someone post and it has been working
> like
> a charm until I installed Office SP2. It doesn't work anymore. Do anyone
> might know what is the issue? I have try re-install Office then also SP2
> with
> no joy.

> Below is the code
> Private SentEntryID As String
> Private SentStoreID As String
> Private WithEvents objSentItems As Items
> Private MailItem As Outlook.MailItem

> Public Sub Application_Startup()
> 'Retrieve ID for accessing non-default sent folder
> getStoreFolderID ("Mailbox - group")
> Set objSentItems =
> Application.Session.GetDefaultFolder(olFolderSentMail).Items
> End Sub

> Function getStoreFolderID(StoreName)
> 'Gets the Shared Account Sent Folder
> Dim Store As Object
> Dim StoreFolder As Object
> Dim i As Integer
> Set Store = Application.GetNamespace("mapi").Folders
> For Each StoreFolder In Store
> If StoreFolder.Name = StoreName Then
> For i = 1 To StoreFolder.Folders.Count
> If StoreFolder.Folders(i).Name = "Sent Items" Then
> SentEntryID = StoreFolder.Folders(i).EntryID
> SentStoreID = StoreFolder.Folders(i).StoreID
> Exit For
> End If
> Next
> Exit For
> End If
> Next
> Set Store = Nothing
> Set StoreFolder = Nothing
> End Function

> Private Sub objSentItems_ItemAdd(ByVal Item As Object)
> 'Fired when something is added to personal "Sent Mail" folder
> If TypeOf Item Is Outlook.MailItem Then
> With Item
> Set MailItem = Application.GetNamespace("mapi").GetItemFromID(.EntryID,
> .Parent.StoreID)
> End With
> If MailItem.SentOnBehalfOfName = "group" Then
> Set DestinationFolder = Application.Session.GetFolderFromID(SentEntryID,
> SentStoreID)
> MailItem.Move (DestinationFolder)
> End If
> End If
> Set MailItem = Nothing
> End Sub

> Any suggestion or thinking are welcomed.

> Thanks.
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

Hi Ken,

Thanks for replying.

It no longer move sent email automatically to "group" mailbox, the sent

email is sitting on individual users mailbox.

If I run it manually it didn't throw any error message at all.

Thank you.
wrote:


> Doesn't work in what way? Does the code run at all? What if you run it
> manually, do you get any errors? Which line or lines throw errors?

> >

>

> "rpratikno" <rpratikno> wrote in message
> news:D47D1D48-7EEF-4C05-9F04-073BC1AEBF63@microsoft.com...
> > Hi guys,
> > I have a macro that will move all email sent with "sendonbehalf"
> > properties
> > to the group mailbox. I found it on someone post and it has been working
> > like
> > a charm until I installed Office SP2. It doesn't work anymore. Do anyone
> > might know what is the issue? I have try re-install Office then also SP2
> > with
> > no joy.
> > Below is the code
> > Private SentEntryID As String
> > Private SentStoreID As String
> > Private WithEvents objSentItems As Items
> > Private MailItem As Outlook.MailItem
> > Public Sub Application_Startup()
> > 'Retrieve ID for accessing non-default sent folder
> > getStoreFolderID ("Mailbox - group")
> > Set objSentItems =
> > Application.Session.GetDefaultFolder(olFolderSentMail).Items
> > End Sub
> > Function getStoreFolderID(StoreName)
> > 'Gets the Shared Account Sent Folder
> > Dim Store As Object
> > Dim StoreFolder As Object
> > Dim i As Integer
> > Set Store = Application.GetNamespace("mapi").Folders
> > For Each StoreFolder In Store
> > If StoreFolder.Name = StoreName Then
> > For i = 1 To StoreFolder.Folders.Count
> > If StoreFolder.Folders(i).Name = "Sent Items" Then
> > SentEntryID = StoreFolder.Folders(i).EntryID
> > SentStoreID = StoreFolder.Folders(i).StoreID
> > Exit For
> > End If
> > Next
> > Exit For
> > End If
> > Next
> > Set Store = Nothing
> > Set StoreFolder = Nothing
> > End Function
> > Private Sub objSentItems_ItemAdd(ByVal Item As Object)
> > 'Fired when something is added to personal "Sent Mail" folder
> > If TypeOf Item Is Outlook.MailItem Then
> > With Item
> > Set MailItem = Application.GetNamespace("mapi").GetItemFromID(.EntryID,
> > .Parent.StoreID)
> > End With
> > If MailItem.SentOnBehalfOfName = "group" Then
> > Set DestinationFolder = Application.Session.GetFolderFromID(SentEntryID,
> > SentStoreID)
> > MailItem.Move (DestinationFolder)
> > End If
> > End If
> > Set MailItem = Nothing
> > End Sub
> > Any suggestion or thinking are welcomed.
> > Thanks.


>
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

What I'd do in that case is to put some Debug.Print statements in the code

in the startup initializer and the code that's supposed to be called and see

where the statements fail to write to the Immediate window and the code is

failing. I'd also set up breakpoints in the getStoreFolderID() and

objSentItems_ItemAdd() methods and send some test messages that should

trigger your code and see what happens. That's about the only way to figure

out what's going on.

"rpratikno" <rpratikno> wrote in message

news:AEEE6080-B65B-4605-940E-ED3B29AF1425@microsoft.com...
> Hi Ken,

> Thanks for replying.

> It no longer move sent email automatically to "group" mailbox, the sent
> email is sitting on individual users mailbox.

> If I run it manually it didn't throw any error message at all.

> Thank you.
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

Hi Ken,

Thanks for the tips to start debugging =) I manage to found the cause.

After installing Outlook SP2, if we reply any group email on group mailbox,

the email From field will no longer contain SendOnBehalf properties, which

definitely break the macro.

Do you have any suggestion to fix it?

Thanks.
wrote:


> What I'd do in that case is to put some Debug.Print statements in the code
> in the startup initializer and the code that's supposed to be called and see
> where the statements fail to write to the Immediate window and the code is
> failing. I'd also set up breakpoints in the getStoreFolderID() and
> objSentItems_ItemAdd() methods and send some test messages that should
> trigger your code and see what happens. That's about the only way to figure
> out what's going on.

> >

>

> "rpratikno" <rpratikno> wrote in message
> news:AEEE6080-B65B-4605-940E-ED3B29AF1425@microsoft.com...
> > Hi Ken,
> > Thanks for replying.
> > It no longer move sent email automatically to "group" mailbox, the sent
> > email is sitting on individual users mailbox.
> > If I run it manually it didn't throw any error message at all.
> > Thank you.


>
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

I'm sorry, I can't reproduce that at all.

I tested with Outlook 2007 SP2 and any reply from a shared mailbox using the

From as the shared mailbox alias always provided SentOnBehalfOfName and the

equivalent MAPI property in the items going to Sent Items in the default

mailbox.

Original emails using that From also had that property on them.

"rpratikno" <rpratikno> wrote in message

news:DF59BC0E-7491-42EB-8BF2-E286C257F511@microsoft.com...
> Hi Ken,

> Thanks for the tips to start debugging =) I manage to found the cause.

> After installing Outlook SP2, if we reply any group email on group
> mailbox,
> the email From field will no longer contain SendOnBehalf properties, which
> definitely break the macro.

> Do you have any suggestion to fix it?

> Thanks.
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

Ken, just curious: If you reply from the mailbox, is the From field in the

UI already filled in with the mailbox name? Or does the user have to fill it

in manually?

Sue Mosher
<kenslovak@mvps.org> wrote in message

news:updvTII2JHA.1416@TK2MSFTNGP04.phx.gbl...
> I'm sorry, I can't reproduce that at all.

> I tested with Outlook 2007 SP2 and any reply from a shared mailbox using
> the From as the shared mailbox alias always provided SentOnBehalfOfName
> and the equivalent MAPI property in the items going to Sent Items in the
> default mailbox.

> Original emails using that From also had that property on them.

> >

>

> "rpratikno" <rpratikno> wrote in message
> news:DF59BC0E-7491-42EB-8BF2-E286C257F511@microsoft.com...
> > Hi Ken,
>

>> Thanks for the tips to start debugging =) I manage to found the cause.
>

>> After installing Outlook SP2, if we reply any group email on group
> > mailbox,
> > the email From field will no longer contain SendOnBehalf properties,
> > which
> > definitely break the macro.
>

>> Do you have any suggestion to fix it?
>

>> Thanks.

>
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

In replying from the mailbox the From is already filled in with the mailbox

SMTP address.

"Sue Mosher [MVP]" <suemvp@turtleflock.com> wrote in message

news:eugNQfI2JHA.1372@TK2MSFTNGP05.phx.gbl...
> Ken, just curious: If you reply from the mailbox, is the From field in the
> UI already filled in with the mailbox name? Or does the user have to fill
> it in manually?

> > Sue Mosher
> > >
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

Hi Ken,

Thanks for trying to reproduce my scenario, I appreciate that. Could you

please define which one is default mailbox? I assume default mailbox is the

sender mailbox, not the shared mailbox. Please correct me if I'm wrong.

The goal of this macro is to automatically move all email that a user reply

from shared mailbox into shared mailbox's sent items, not to the user

sender/default sent items.

I used Macro "watch" to see string value on the MailItem property. When I

hit reply on shared mailbox's email, the MailItem's SharedOnBehalfOfName

property string value is the user's name instead of the shared mailbox's name.

I did check what the recipient see on their side, the email From field is

"user on behalf of shared". On sender side (me) the email From field is only

"user" without "on behalf of shared". So I'm positive the issue is on Outlook

instead of Exchange server. I got 10 users having the same issue here.

Could you please assist me more further? Your help is much appreciated.
wrote:


> I'm sorry, I can't reproduce that at all.

> I tested with Outlook 2007 SP2 and any reply from a shared mailbox using the
> From as the shared mailbox alias always provided SentOnBehalfOfName and the
> equivalent MAPI property in the items going to Sent Items in the default
> mailbox.

> Original emails using that From also had that property on them.

> >

>

> "rpratikno" <rpratikno> wrote in message
> news:DF59BC0E-7491-42EB-8BF2-E286C257F511@microsoft.com...
> > Hi Ken,
> > Thanks for the tips to start debugging =) I manage to found the cause.
> > After installing Outlook SP2, if we reply any group email on group
> > mailbox,
> > the email From field will no longer contain SendOnBehalf properties, which
> > definitely break the macro.
> > Do you have any suggestion to fix it?
> > Thanks.


>
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

I told you already that I tested this on Outlook 2007 SP2 and did not find

what you are finding. So it is not a bug in Outlook 2007 SP2. Why you see

the results you see I have no idea, but if it was a bug in the service pack

I'd see it here also on the 2 computers I tested on.

"rpratikno" <rpratikno> wrote in message

news:E5A881B9-537B-44AB-BC06-8AF1105EED60@microsoft.com...
> Hi Ken,

> Thanks for replying.

> I do understand your explanation are what the Exchange features and
> default.
> When you reply email on Sales mailbox, the email that you sent will go to
> the
> profile sent items, which is not what our organisation want. That is the
> reason I use the macro, we want the sent email of replying Sales mailbox
> not
> to the profile's Sent Items, yet to the Sales mailbox's sent items.

> What I found is on Outlook side (not Exchange), with Outlook SP2, the
> SendOnBehalfOfName property is no longer contain the Sales' name. It is
> now
> contain profile's name. This is not happening before Outlook SP2, I'm
> wondering if this is a bug on Office SP2? I didn't make any changes on the
> macro code. The exactly same macro works fine prior to Office SP2.

> However, at the reply email receiver the sender name is correct, which is
> "profile on behalf of sales". So I'm sure this is not the problem of
> Exchange
> configuration.

> Will you be able to confirm that this is a bug on Office SP2? Please do
> correct me if I'm wrong.

> Thank you very much for your thinking, it is much appreciated.
 
Re: After Office 2007 SP2 install - Outlook 2007 macro no longer w

"rpratikno" wrote:


> Hi Ken,

> Thanks for trying to reproduce my scenario, I appreciate that. Could you
> please define which one is default mailbox? I assume default mailbox is the
> sender mailbox, not the shared mailbox. Please correct me if I'm wrong.

> The goal of this macro is to automatically move all email that a user reply
> from shared mailbox into shared mailbox's sent items, not to the user
> sender/default sent items.

> I used Macro "watch" to see string value on the MailItem property. When I
> hit reply on shared mailbox's email, the MailItem's SharedOnBehalfOfName
> property string value is the user's name instead of the shared mailbox's name.

> I did check what the recipient see on their side, the email From field is
> "user on behalf of shared". On sender side (me) the email From field is only
> "user" without "on behalf of shared". So I'm positive the issue is on Outlook
> instead of Exchange server. I got 10 users having the same issue here.

> Could you please assist me more further? Your help is much appreciated.

> " - " wrote:
>
> > I'm sorry, I can't reproduce that at all.
> > I tested with Outlook 2007 SP2 and any reply from a shared mailbox using the
> > From as the shared mailbox alias always provided SentOnBehalfOfName and the
> > equivalent MAPI property in the items going to Sent Items in the default
> > mailbox.
> > Original emails using that From also had that property on them.
> > > >

> >

> > "rpratikno" <rpratikno> wrote in message
> > news:DF59BC0E-7491-42EB-8BF2-E286C257F511@microsoft.com...
> > > Hi Ken,
> > > > Thanks for the tips to start debugging =) I manage to found the cause.
> > > > After installing Outlook SP2, if we reply any group email on group
> > > mailbox,
> > > the email From field will no longer contain SendOnBehalf properties, which
> > > definitely break the macro.
> > > > Do you have any suggestion to fix it?
> > > > Thanks.

> >
 
I have the same problem.

I don't use your macro but a com plugin UniSent (same issue)

If you start a mail from scratch the problem doesn't exist

If you <clear FromField> + <Retype what was there> the problem doesn't exist

(Actually its enough to just hit <enter> in the AutoPoppulated FromField).

Big problem hope someone can solve it.

:) Morten

"rpratikno" wrote:


> Hi guys,

> I have a macro that will move all email sent with "sendonbehalf" properties
> to the group mailbox. I found it on someone post and it has been working like
> a charm until I installed Office SP2. It doesn't work anymore. Do anyone
> might know what is the issue? I have try re-install Office then also SP2 with
> no joy.

> Below is the code
> Private SentEntryID As String
> Private SentStoreID As String
> Private WithEvents objSentItems As Items
> Private MailItem As Outlook.MailItem

> Public Sub Application_Startup()
> 'Retrieve ID for accessing non-default sent folder
> getStoreFolderID ("Mailbox - group")
> Set objSentItems =
> Application.Session.GetDefaultFolder(olFolderSentMail).Items
> End Sub

> Function getStoreFolderID(StoreName)
> 'Gets the Shared Account Sent Folder
> Dim Store As Object
> Dim StoreFolder As Object
> Dim i As Integer
> Set Store = Application.GetNamespace("mapi").Folders
> For Each StoreFolder In Store
> If StoreFolder.Name = StoreName Then
> For i = 1 To StoreFolder.Folders.Count
> If StoreFolder.Folders(i).Name = "Sent Items" Then
> SentEntryID = StoreFolder.Folders(i).EntryID
> SentStoreID = StoreFolder.Folders(i).StoreID
> Exit For
> End If
> Next
> Exit For
> End If
> Next
> Set Store = Nothing
> Set StoreFolder = Nothing
> End Function

> Private Sub objSentItems_ItemAdd(ByVal Item As Object)
> 'Fired when something is added to personal "Sent Mail" folder
> If TypeOf Item Is Outlook.MailItem Then
> With Item
> Set MailItem = Application.GetNamespace("mapi").GetItemFromID(.EntryID,
> .Parent.StoreID)
> End With
> If MailItem.SentOnBehalfOfName = "group" Then
> Set DestinationFolder = Application.Session.GetFolderFromID(SentEntryID,
> SentStoreID)
> MailItem.Move (DestinationFolder)
> End If
> End If
> Set MailItem = Nothing
> End Sub

> Any suggestion or thinking are welcomed.

> Thanks.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Office 2007 SP2 Install: BCM Update Failure BCM (Business Contact Manager) 25
A After update to SP2 (office 2007) Launching a campaign fails BCM (Business Contact Manager) 3
B Migrate Outlook 2007 to Office 365 Using Outlook 3
P outlook addin unloaded in office 2007 Using Outlook 0
P Oulook addin unloaded in office 2007 Outlook VBA and Custom Forms 2
D Outlook (Office) 2007 & Windows 10 Pro Using Outlook 6
Diane Poremsky Outlook 2007 with Office 365? Using Outlook 0
D Need Genuine Office or Outlook 2007 Using Outlook 3
E Upgrade Issues - Office/Outlook 2007 to 2010 Using Outlook 0
E Microsoft Office Outlook 2007 Send Error Using Outlook 11
K Outlook 2007 using in office and at home Using Outlook 1
Jon Bakrley Outlook 2013 and Exchange 2007, Out of the office error message Using Outlook 8
C Office 2007 Distribution Lists Using Outlook 1
B Microsoft office outlook 2007 showing configuring outlook accounts for hours Using Outlook 6
J Can't send/receive in Office 2007 Using Outlook 1
N Do I need outlook connector for office 2010 as with outlook 2007? Using Outlook.com accounts in Outlook 1
H 2007 Office Outlook BCM (Business Contact Manager) 1
M Upgrading from Office 2003 to 2007 Ent, calendar permissions lost? BCM (Business Contact Manager) 1
V Already have Office 2007 Prof Plus, want to get BCM BCM (Business Contact Manager) 4
J Office 2007 Professional Plus BCM (Business Contact Manager) 1
S BCM in Office Ultimate 2007 Won't Install on W7 Ultimate 32 BCM (Business Contact Manager) 1
M trust center in office 2007 freezes Using Outlook 2
H popup window "Location Information" Microsoft Office Outlook 2007 Using Outlook 3
K Adding Image to "new email window" in Office 2007 Outlook VBA and Custom Forms 2
Z Out of Office Assistant in Microsoft Outlook 2007 Using Outlook 3
V Outlook 2007: How to read/write Out-of-Office settings Outlook VBA and Custom Forms 3
M How do I get Office to forget about 12/2007? Outlook VBA and Custom Forms 1
P MICROSOFT OFFICE 2007 FREEZING UP HOW DO I FIX ? BCM (Business Contact Manager) 2
L HUP Office 2007, MSSMLBIZ.msi error, outlook not installed BCM (Business Contact Manager) 1
Y Q's Regarding Office 2019 Using Outlook 0
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
G Save emails as msg file from Outlook Web AddIn (Office JS) Outlook VBA and Custom Forms 0
S Import PST to Office 365 Using Outlook 1
C Migrate Exchange to Office 365 Using Outlook 2
P now on office 365 but getting error messages about missing Outlook 2013 cache folders Using Outlook 2
S Outlook 2016 and Acrobat PDFMaker Office COM Addin Using Outlook 0
U Rolling Back Office broke automatic updates Using Outlook 4
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
S client lost 3K contacts when office 365 for mac account deleted from company exchange server Using Outlook 5
J Outlook search bar in Office 2021 Professional Using Outlook 1
J Outlook 2016 Trying to get Outlook 2016 to work with Office 365 Using Outlook 0
P "Item could not be moved" message occurs frequently for IMAP inbox, Office 365 Using Outlook 0
S Outlook 2021 How to customize colors Outlook 2021 & Office 2021 on PC Using Outlook 1
O Office 365 - Zoom Using Outlook 0
C Wishlist Extract or scan new email addresses from out of office replies. Leads from OOO replies Using Outlook 1
M Upgrading from: MS Office Professional Plus 2010 to: MS Office Professional Plus 2021 Using Outlook.com accounts in Outlook 16
D Office 365 Outlook desktop app prompts for all account passwords on startup Using Outlook 11
e_a_g_l_e_p_i Has nobody used Office 2021 enough to help me or have you given up on me.......lol Using Outlook 1
V Outlook 2021 Microsoft Office Pro Plus 2021 - Inexpensive Lifetime License Using Outlook 6
J Connect outlook to office365 exchange _without_ signing in office apps Using Outlook 4

Similar threads

Back
Top