PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Repost with more info - Saving a task to a child folder

Reply

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

 
Thread Tools Rate Thread
Old 16-12-2006, 05:36 PM   #1
Carol G
Guest
 
Posts: n/a
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


  Reply With Quote
Old 16-12-2006, 05:44 PM   #2
Sue Mosher [MVP-Outlook]
Guest
 
Posts: n/a
Default Re: 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" <cgeddes@shaw.ca> 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
>
>

  Reply With Quote
Old 16-12-2006, 06:38 PM   #3
Carol G
Guest
 
Posts: n/a
Default Re: Repost with more info - Saving a task to a child folder

Thanks Again,
Carol

"Sue Mosher [MVP-Outlook]" <suemvp@outlookcode.com> wrote in message
news:eM1pK5TIHHA.3312@TK2MSFTNGP03.phx.gbl...
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" <cgeddes@shaw.ca> 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
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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