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

Using Postitem



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 13th 06, 04:33 PM posted to microsoft.public.outlook.program_vba
JimRBG
external usenet poster
 
Posts: 9
Default Using Postitem

I have the following code, but I can't seem to find a way to directly post to
my current folder. The postitem always goes to the Inbox. If I add the move
function I can put it in the correct folder, but then the post is closed and
I have to open it an revise the contents to add my comments.

I'd greatly appreciate some help with this.

Thanks,

Jim

As an example, I have a personal folders (.pst file) containing active
tickets. With each ticket I track all email and activity and make comments
about contacts with customers.

The Post in this Folder (say Ticket1) is what I'm trying to get, but with
the added infomation already displayed in the Subject Field.

Active Tickets
Ticket1
Ticket2

..etc

Sub myPost()
Dim olApp As Outlook.Application
Dim objPost As Outlook.PostItem
Dim onsMapi As Outlook.NameSpace
Dim ofldrSrc As Outlook.MAPIFolder
Dim strReport As String

' Get the current Folder
Set olApp = Outlook.Application
Set onsMapi = olApp.GetNamespace("MAPI")
Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set objPost = olApp.CreateItem(olPostItem)
strReport = ofldrSrc


With objPost
.Subject = "Service Desk ticket - " & Right(strReport, 8)
'.Post
.Display

End With

'objPost.Move ofldrSrc
End Sub
Ads
  #2  
Old October 13th 06, 04:50 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Using Postitem

Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set objPost = ofldrSrc.Items.Add("IPM.Post")
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"JimRBG" wrote in message ...
I have the following code, but I can't seem to find a way to directly post to
my current folder. The postitem always goes to the Inbox. If I add the move
function I can put it in the correct folder, but then the post is closed and
I have to open it an revise the contents to add my comments.

I'd greatly appreciate some help with this.

Thanks,

Jim

As an example, I have a personal folders (.pst file) containing active
tickets. With each ticket I track all email and activity and make comments
about contacts with customers.

The Post in this Folder (say Ticket1) is what I'm trying to get, but with
the added infomation already displayed in the Subject Field.

Active Tickets
Ticket1
Ticket2

..etc

Sub myPost()
Dim olApp As Outlook.Application
Dim objPost As Outlook.PostItem
Dim onsMapi As Outlook.NameSpace
Dim ofldrSrc As Outlook.MAPIFolder
Dim strReport As String

' Get the current Folder
Set olApp = Outlook.Application
Set onsMapi = olApp.GetNamespace("MAPI")
Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set objPost = olApp.CreateItem(olPostItem)
strReport = ofldrSrc


With objPost
.Subject = "Service Desk ticket - " & Right(strReport, 8)
'.Post
.Display

End With

'objPost.Move ofldrSrc
End Sub

  #3  
Old October 13th 06, 06:13 PM posted to microsoft.public.outlook.program_vba
JimRBG
external usenet poster
 
Posts: 9
Default Using Postitem

Sue,

Thank you very much. That was what I was missing.

Jim

"Sue Mosher [MVP-Outlook]" wrote:

Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set objPost = ofldrSrc.Items.Add("IPM.Post")
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"JimRBG" wrote in message ...
I have the following code, but I can't seem to find a way to directly post to
my current folder. The postitem always goes to the Inbox. If I add the move
function I can put it in the correct folder, but then the post is closed and
I have to open it an revise the contents to add my comments.

I'd greatly appreciate some help with this.

Thanks,

Jim

As an example, I have a personal folders (.pst file) containing active
tickets. With each ticket I track all email and activity and make comments
about contacts with customers.

The Post in this Folder (say Ticket1) is what I'm trying to get, but with
the added infomation already displayed in the Subject Field.

Active Tickets
Ticket1
Ticket2

..etc

Sub myPost()
Dim olApp As Outlook.Application
Dim objPost As Outlook.PostItem
Dim onsMapi As Outlook.NameSpace
Dim ofldrSrc As Outlook.MAPIFolder
Dim strReport As String

' Get the current Folder
Set olApp = Outlook.Application
Set onsMapi = olApp.GetNamespace("MAPI")
Set ofldrSrc = olApp.ActiveExplorer.CurrentFolder
Set objPost = olApp.CreateItem(olPostItem)
strReport = ofldrSrc


With objPost
.Subject = "Service Desk ticket - " & Right(strReport, 8)
'.Post
.Display

End With

'objPost.Move ofldrSrc
End Sub


 




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


All times are GMT +1. The time now is 07:06 AM.


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