PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Anyone Remember PROFS?
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Anyone Remember PROFS?
![]() |
Anyone Remember PROFS? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I know I'm showing my age...
One of my favorite things about PROFS was the very easy ability to define a momentary destination folder for the copy of my e-mail that I'm about to send. Outlook lets you do this after a gazillion clicks and menu selections (View | Options, (persistently) checking "Save Sent Messages to:" and browsing for a folder). In PROFS, all one had to do was type ".pf foldername" on a dedicated line. After poking around in Application_ItemSend, I found that the property SaveSentMessageFolder appeared to be what I was after; when I changed it through the menus as described above, this property also changed. So I figured all I had to do was create a little function to search for the ".pf" string, get the value typed, and override the above property before the end of Application_ItemSend. All this did, however, was change the name of my Sent Items folder to whatever name I chose. What am I doing wrong? I'm kinda self-taught in the VBA arena, so no qualms about correcting my form are expected/required. ![]() *property override: objItem.SaveSentMessageFolder = GetSentMessageFolder(objItem.Body) *function (in it's infancy, it doesn't yet remove the .pf line, nor validate the folder name (have NO idea how to do that yet), just at the moment getting the folder name: Public Function GetSentMessageFolder(sBody As String) As String Dim i As Integer Dim ii As Integer i = InStr(sBody, ".pf") If i > 0 Then ii = InStr(i + 3, sBody, vbCrLf) GetSentMessageFolder = Mid(sBody, i + 4, ii - (i + 4)) Else GetSentMessageFolder = "Sent Items" End If End Function |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You forgot that SaveSentMessageFolder is an object property (MAPIFolder) and
therefore requires the Set keyword. See http://www.outlookcode.com/d/code/setsavefolder.htm for a VBA code sample that's close to what you're doing. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Chris" <AccessCaz@pobox.com> wrote in message news:u5FD2NkfEHA.904@TK2MSFTNGP09.phx.gbl... > I know I'm showing my age... > > One of my favorite things about PROFS was the very easy ability to define a > momentary destination folder for the copy of my e-mail that I'm about to > send. Outlook lets you do this after a gazillion clicks and menu selections > (View | Options, (persistently) checking "Save Sent Messages to:" and > browsing for a folder). In PROFS, all one had to do was type ".pf > foldername" on a dedicated line. > > After poking around in Application_ItemSend, I found that the property > SaveSentMessageFolder appeared to be what I was after; when I changed it > through the menus as described above, this property also changed. > > So I figured all I had to do was create a little function to search for the > ".pf" string, get the value typed, and override the above property before > the end of Application_ItemSend. All this did, however, was change the name > of my Sent Items folder to whatever name I chose. What am I doing wrong? > I'm kinda self-taught in the VBA arena, so no qualms about correcting my > form are expected/required. ![]() > > *property override: > > objItem.SaveSentMessageFolder = GetSentMessageFolder(objItem.Body) > > *function (in it's infancy, it doesn't yet remove the .pf line, nor validate > the folder name (have NO idea how to do that yet), just at the moment > getting the folder name: > > Public Function GetSentMessageFolder(sBody As String) As String > Dim i As Integer > Dim ii As Integer > i = InStr(sBody, ".pf") > If i > 0 Then > ii = InStr(i + 3, sBody, vbCrLf) > GetSentMessageFolder = Mid(sBody, i + 4, ii - (i + 4)) > Else > GetSentMessageFolder = "Sent Items" > End If > End Function > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
GetSentMessageFolder function returns a string, not MAPIFolder, which
changes the default property of the objItem.SaveSentMessageFolder object, which happens to be Name. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Chris" <AccessCaz@pobox.com> wrote in message news:u5FD2NkfEHA.904@TK2MSFTNGP09.phx.gbl... > I know I'm showing my age... > > One of my favorite things about PROFS was the very easy ability to define a > momentary destination folder for the copy of my e-mail that I'm about to > send. Outlook lets you do this after a gazillion clicks and menu selections > (View | Options, (persistently) checking "Save Sent Messages to:" and > browsing for a folder). In PROFS, all one had to do was type ".pf > foldername" on a dedicated line. > > After poking around in Application_ItemSend, I found that the property > SaveSentMessageFolder appeared to be what I was after; when I changed it > through the menus as described above, this property also changed. > > So I figured all I had to do was create a little function to search for the > ".pf" string, get the value typed, and override the above property before > the end of Application_ItemSend. All this did, however, was change the name > of my Sent Items folder to whatever name I chose. What am I doing wrong? > I'm kinda self-taught in the VBA arena, so no qualms about correcting my > form are expected/required. ![]() > > *property override: > > objItem.SaveSentMessageFolder = GetSentMessageFolder(objItem.Body) > > *function (in it's infancy, it doesn't yet remove the .pf line, nor validate > the folder name (have NO idea how to do that yet), just at the moment > getting the folder name: > > Public Function GetSentMessageFolder(sBody As String) As String > Dim i As Integer > Dim ii As Integer > i = InStr(sBody, ".pf") > If i > 0 Then > ii = InStr(i + 3, sBody, vbCrLf) > GetSentMessageFolder = Mid(sBody, i + 4, ii - (i + 4)) > Else > GetSentMessageFolder = "Sent Items" > End If > End Function > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


