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

Usint Postitem



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

I have the following code that I am trying to use a Postitem and post it
directly to my current folder. For example:

Active Tickets
Ticket1
Ticket2
..etc

When I execute the code the post will always go to the Inbox vs. the current
folder (say Ticket1). I can perform a move, but the post is closed and then
I have to open it and revise it to include my comments.

I'm trying to duplicate the Post in this Folder function, but with the added
information in the Subject Field already displayed.

Any help appreciated.

Jim
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
  #2  
Old October 13th 06, 04:51 PM posted to microsoft.public.outlook.program_vba
JimRBG
external usenet poster
 
Posts: 9
Default Usint Postitem

Sorry for the second post, when I submitted the first I got an error message
that it failed. Please ignor this one.

"JimRBG" wrote:

I have the following code that I am trying to use a Postitem and post it
directly to my current folder. For example:

Active Tickets
Ticket1
Ticket2
..etc

When I execute the code the post will always go to the Inbox vs. the current
folder (say Ticket1). I can perform a move, but the post is closed and then
I have to open it and revise it to include my comments.

I'm trying to duplicate the Post in this Folder function, but with the added
information in the Subject Field already displayed.

Any help appreciated.

Jim
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Postitem JimRBG Outlook and VBA 2 October 13th 06 06:13 PM


All times are GMT +1. The time now is 08:15 PM.


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.