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

Repost with more info - Saving a task to a child folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 16th 06, 06:36 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Repost with more info - Saving a task to a child folder

This does not save the new task in the Test folder. In fact it doesn't seem
to be saving anywere.
Thanks for any help.
Carol

Public Sub TaskTest()

Dim objApp As Outlook.Application
Dim MyTasksFolder As Outlook.MAPIFolder
Dim MyFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItm As TaskItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set MyTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
Set MyFolder = MyTasksFolder.Folders("Test")
Debug.Print MyFolder

Set objItm = objApp.CreateItem(olTaskItem)

objItm.Subject = "Test of Task2"
'Debug.Print objItm.Subject
objItm.SaveAs (MyFolder)
Debug.Print objItm.Subject


End Sub


Ads
  #2  
Old December 16th 06, 06:44 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Repost with more info - Saving a task to a child folder

This statement

Set objItm = myFolder.Items.Add

will create a task item that saves in the Test folder. The correct method to save an item is Save, not SaveAs.

--
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

"Carol G" wrote in message news:Y8Wgh.487421$1T2.441693@pd7urf2no...
This does not save the new task in the Test folder. In fact it doesn't seem
to be saving anywere.
Thanks for any help.
Carol

Public Sub TaskTest()

Dim objApp As Outlook.Application
Dim MyTasksFolder As Outlook.MAPIFolder
Dim MyFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItm As TaskItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set MyTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
Set MyFolder = MyTasksFolder.Folders("Test")
Debug.Print MyFolder

Set objItm = objApp.CreateItem(olTaskItem)

objItm.Subject = "Test of Task2"
'Debug.Print objItm.Subject
objItm.SaveAs (MyFolder)
Debug.Print objItm.Subject


End Sub


  #3  
Old December 16th 06, 07:38 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Repost with more info - Saving a task to a child folder

Thanks Again,
Carol

"Sue Mosher [MVP-Outlook]" wrote in message
...
This statement

Set objItm = myFolder.Items.Add

will create a task item that saves in the Test folder. The correct method to
save an item is Save, not SaveAs.

--
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

"Carol G" wrote in message
news:Y8Wgh.487421$1T2.441693@pd7urf2no...
This does not save the new task in the Test folder. In fact it doesn't

seem
to be saving anywere.
Thanks for any help.
Carol

Public Sub TaskTest()

Dim objApp As Outlook.Application
Dim MyTasksFolder As Outlook.MAPIFolder
Dim MyFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItm As TaskItem

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set MyTasksFolder = objNS.GetDefaultFolder(olFolderTasks)
Set MyFolder = MyTasksFolder.Folders("Test")
Debug.Print MyFolder

Set objItm = objApp.CreateItem(olTaskItem)

objItm.Subject = "Test of Task2"
'Debug.Print objItm.Subject
objItm.SaveAs (MyFolder)
Debug.Print objItm.Subject


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
Saving a task item to a child folder Carol G Outlook and VBA 1 December 17th 06 06:41 AM
Customized Task form not saving data RClauss Outlook - Using Forms 3 October 25th 06 04:46 PM
saving problem in default task folder - permission related? Haraszti Zoltán Outlook - General Queries 1 July 5th 06 12:24 PM
Saving text included on customised task page bg Outlook - Using Forms 1 July 4th 06 04:06 AM
Saving contact info to vCards Avila Outlook - Using Contacts 3 June 23rd 06 03:25 PM


All times are GMT +1. The time now is 12:43 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.