PDA

View Full Version : Help with .SaveSentMessageFolder: does not work for some folders



Blakearino
02-13-2014, 03:16 PM
Hello all
I could use some help with Outlook Macros. (having loads of fun with posting things)

In Outlook 2010 I(alpha) have access to the folders of another account(beta)
I normally send out reports from (beta) to get approvals.
The code below creates the emails, adds voting buttons and attaches the browsed for reports.
It also sets the .SaveSentMessageFolder. The issue I have is that the messages cannot be saved to the proper folder on (beta).
The macro runs with no apparent error but the message is saved to the (alpha) Sent Items folder.
If I change the path of the .SaveSentMessageFolder to a folder in (alpha) the macro works.
I have tested the
butch = "\\doofus\Inbox\randy" 'Save to folder path
Set folder = GetFolder(butch) 'Get Save to folder object
with a move instruction and it works both for an email in the (alpha) account and in the (beta) account.
So I believe I have the correct object.
Why does it ignore the .SaveSentMessageFolder for folders in the (beta) account?
(Cannot get my code passed the post nazi)

westconn1
02-14-2014, 01:14 AM
are your reports sent out as from alpha or beta?

Blakearino
02-14-2014, 09:47 AM
are your reports sent out as from alpha or beta?

They are sent from beta. I am alpha
Alpha(me)
|-----Inbox
|-----Afolder


Beta
|-----Inbox
|-----Report1
|-----Report2


I can save to Afolder but not to Report1 or Report2.
I have also tried
Set myRecipient = ns.CreateRecipient("beta")
myRecipient.Resolve
Set moveToFolder = ns.GetSharedDefaultFolder(myRecipient, olFolderInbox).Folders("Report1")
Set .SaveSentMessageFolder = moveToFolder
With the same result. Is there a permissions issue?


Public Sub HTML_Test()
Dim objMsg3 As MailItem
Dim folder As Outlook.folder
signature = "<pr> </pr> "
Set objMsg3 = Application.CreateItem(olMailItem) ' create email
With objMsg3

.To = ""
Do While .ReplyRecipients.Count > 0 ' removes current recipients
.ReplyRecipients.Remove 1
Loop
.ReplyRecipients.Add "beta" ' Reply To:
butch = "\\alpha\Inbox\Report1" 'Save to folder path
Set folder = GetFolder(butch) 'Get Save to folder object
Set .SaveSentMessageFolder = folder
.Subject = ""
.SentOnBehalfOfName = "beta" 'the From: field
.BodyFormat = olFormatHTML ' make the format HTML message
.VotingOptions = "Approve;Approve with Comments;"
.HTMLBody = "<p>Hi NPH, <br> <br> </p>" & signature
.Display
End With
Set objMsg3 = Nothing
End Sub

westconn1
02-15-2014, 10:45 PM
Is there a permissions issue?that would be my first guess
if you do not set the folder, where do the sentitems go by default?