A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 15th 09, 07:45 AM posted to microsoft.public.outlook.program_vba
rpratikno
external usenet poster
 
Posts: 5
Default After Office 2007 SP2 install - Outlook 2007 macro no longer worki

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(olFolderSentM ail).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(.En tryID,
..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.
Ads
  #2  
Old May 15th 09, 02:06 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default After Office 2007 SP2 install - Outlook 2007 macro no longer worki

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?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
news
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(olFolderSentM ail).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(.En tryID,
.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.


  #3  
Old May 18th 09, 12:22 AM posted to microsoft.public.outlook.program_vba
rpratikno
external usenet poster
 
Posts: 5
Default 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.



"Ken Slovak - [MVP - Outlook]" 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?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
news
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(olFolderSentM ail).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(.En tryID,
.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.



  #4  
Old May 18th 09, 03:04 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
...
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.


  #5  
Old May 19th 09, 01:21 AM posted to microsoft.public.outlook.program_vba
rpratikno
external usenet poster
 
Posts: 5
Default 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.


"Ken Slovak - [MVP - Outlook]" 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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
...
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.



  #6  
Old May 19th 09, 02:02 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
news
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.


  #7  
Old May 19th 09, 02:43 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default 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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Ken Slovak - [MVP - Outlook]" wrote in message
...
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
news
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.




  #8  
Old May 19th 09, 06:14 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sue Mosher [MVP]" wrote in message
...
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, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


  #9  
Old May 19th 09, 11:30 PM posted to microsoft.public.outlook.program_vba
rpratikno
external usenet poster
 
Posts: 5
Default 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.

"Ken Slovak - [MVP - Outlook]" 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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
news
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.



  #10  
Old May 20th 09, 01:49 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default After Office 2007 SP2 install - Outlook 2007 macro no longer w

The default mailbox is wherever the emails are delivered for that Outlook
profile. It would be the mailbox for that Exchange alias.

What shows up in From would depend on which alias is answering that email
and what permissions they have on the shared mailbox. You can have send on
behalf of permissions, which shows one thing in From. You can have
SendAs/ReceiveAs permissions, which allow you to send as if you were that
mailbox alias. For example, if I answer an email from my Sales mailbox the
answer goes out from Sales since I gave myself SendAs/ReceiveAs permissions
on that mailbox, even though I'm logged into my own mailbox.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"rpratikno" wrote in message
...
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.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 no longer installed after SP2 2007 Office Suites upda PGP Outlook - Installation 2 May 1st 09 12:16 PM
Since we installed Office 2007, Outlook 2003 no longer runs JacquesT Outlook - General Queries 1 January 27th 09 09:17 PM
SoundMAX audio no longer loads under Office 2007 install? JVRudnick Outlook - General Queries 1 January 3rd 08 07:34 PM
can't uninstall 2007 Trial to install Office 2007 Christopher Glaeser Outlook - Installation 0 February 16th 07 05:29 AM
outlook did not install with office 2007 FufkinPro Outlook - Installation 3 January 18th 07 11:35 PM


All times are GMT +1. The time now is 10:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.