View Full Version : Copy certain messages to 'waiting for' sub folder
RoyLiam
04-13-2007, 11:06 PM
Hi there
After sending a message I often copy it from the sent items to a sub folder of my inbox called 'waiting for' so that I can periodically check what messages I am waiting a reply on.
I would like to create a duplicate send button say 'Send Request' which as well as send the message will copy the sent message to the 'waiting for' folder as well.
I have got the code from the kbase for adding a button to an open mail window, which is fine, and the code in there to send the message, which is fine,
Private Sub oMailButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
oOpenMail.Send
End Sub
but I am at rather a loss as to how to code to copy the message from sent items to the sub folder.
I have had a look through the forum and kbase but not found the code that I am looking for. Can anyone point me in the right direction?
Thanks
Demosthine
10-01-2008, 05:06 PM
Hey There.
Hopefully you've figured this out long before now and just never closed this thread as solved, but here is the solution if you haven't.
The easiest way to do this since you already have the CommandButton declared and the appropriate MailItem defined to an Object, is to set the ?Sent Items? folder to your ?Waiting For? folder for this message. The code is quite simple and you?ll just add it to your oMailButton_Click Event.
Private Sub oMailButton_Click(ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
Dim olWaitingForFolder as MAPIFolder
With Application.Session
Set olWaitingForFolder = .GetDefaultFolder(olFolderSentItems).Folders.Item(?Waiting For?)
Set oOpenMail.SaveSentMessageFolder = olWaitingForFolder
oOpenMail.Send
End With
End Sub
Good luck.
Scott
RoyLiam
10-02-2008, 10:29 PM
Thanks for this Scott - still here! I tried pasting the code in and got a 'Syntax Error' when trying to compile on the following line-
Set olWaitingForFolder = .GetDefaultFolder(olFolderSentItems).Folders.Item(?Waiting For?)
I wondered if this related having to ensure that the folder existed and so I added the folder in both the Personal Folders and as a sub folder in the Sent Items folder but this didn't seem to help.
I am sure it is a simple thing, but any ideas?
Thanks!
dewey1973
10-03-2008, 01:10 PM
It's not VBA, but I just use the method found here...
waiting-for (dot) com
(I'm sorry for the lack of URL, but my post count is not high enough to post a link.)
RoyLiam
10-05-2008, 10:32 PM
Thanks, I hadn't seen this - this is useful
Demosthine
10-05-2008, 11:32 PM
Evening Roy.
The "Waiting For" folder should be a sub-folder in your Sent Items. Make sure that the two names are matching exact. Other than that, there is no reason for that line to error out.
Not that any of that code matters now that Dewey provided a much simpler method of doing this. Thank you Dewey, that's a much more efficient method!
Scott
RoyLiam
10-06-2008, 11:01 PM
Thanks Scott - it's wierd I cant see why its erroring. The folder is in the sent items folder. I wondered if it might be because my mail email account is a IMAP account compared to a POP or exchange account and therefore the default email sent items folder is in a different format. I have tried adding the Waiting For folder in there but no joy. For the time being I agree that Dewey's method works just fine!
Demosthine
10-07-2008, 05:47 PM
Well, I'm glad things worked out regardless.
Since this thread is solved, though, at the top right of your original post, you'll find a link called "Thread Tools" If you click that, you should be able to mark your post as "Solved" so that others will know it has a solution.
Good luck.
Scott
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.