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

Creating a Task with VBScript



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 27th 09, 06:11 PM posted to microsoft.public.outlook.program_vba
yannickestrada
external usenet poster
 
Posts: 13
Default Creating a Task with VBScript

I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with Item?

Regards.

"Ken Slovak - [MVP - Outlook]" wrote:

You need the contact as a ContactItem. Then get the Links collection of the
new task item and add that ContactItem to the Links collection of the task
using the Links.Add method.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in message
...
Regards.

Hi I´m trying to create a task in a custom Contact form in Outlook. I
would
like that the task appears in the Activities tab, but I only get to create
the task in the session, can´t associate with the current contact form.

How I can do that?

I was trying to link the Task Item with the contact form bu that don´t
seems
to work.

Thanks for your help.
Yannick



  #2  
Old July 27th 09, 06:58 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Creating a Task with VBScript

Item should work if the item is a contact item. Form code is VBScript, so it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with Item?

Regards.


  #3  
Old July 27th 09, 08:35 PM posted to microsoft.public.outlook.program_vba
yannickestrada
external usenet poster
 
Posts: 13
Default Creating a Task with VBScript

Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.

"Ken Slovak - [MVP - Outlook]" wrote:

Item should work if the item is a contact item. Form code is VBScript, so it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with Item?

Regards.



  #4  
Old July 27th 09, 09:13 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Creating a Task with VBScript

Try an experiment and do the same code in the Outlook VBA project. Declare
the item as a ContactItem and get it from
Application.ActiveInspector.CurrentItem. Then run the code that creates a
new task and see if the adding to the Links collection works there.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.


  #5  
Old July 28th 09, 12:17 AM posted to microsoft.public.outlook.program_vba
yannickestrada
external usenet poster
 
Posts: 13
Default Creating a Task with VBScript

It´s works, but the task doesn´t appear in the Activities tab. Instead
appears the Form as a Contact element.

Thanks.

"Ken Slovak - [MVP - Outlook]" wrote:

Try an experiment and do the same code in the Outlook VBA project. Declare
the item as a ContactItem and get it from
Application.ActiveInspector.CurrentItem. Then run the code that creates a
new task and see if the adding to the Links collection works there.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.



  #6  
Old July 28th 09, 02:00 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Creating a Task with VBScript

Here's another idea: Try saving the item before you call Links.Add

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"yannickestrada" wrote in message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.

"Ken Slovak - [MVP - Outlook]" wrote:

Item should work if the item is a contact item. Form code is VBScript, so
it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in
message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with Item?

Regards.





  #7  
Old July 28th 09, 02:26 PM posted to microsoft.public.outlook.program_vba
yannickestrada
external usenet poster
 
Posts: 13
Default Creating a Task with VBScript

Thanks Sue, that works.

But know I had 2 problems. The task doesn´t appear in the Activities tab
like I expected, instead appears my custom form as a contact element.

The other problem is that the elements in Activities tab sometimes appears
sometimes not. Why is that? I use Outlook 2007.

Regards

"Sue Mosher [MVP]" wrote:

Here's another idea: Try saving the item before you call Links.Add

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"yannickestrada" wrote in message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.

"Ken Slovak - [MVP - Outlook]" wrote:

Item should work if the item is a contact item. Form code is VBScript, so
it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"yannickestrada" wrote in
message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with Item?

Regards.





  #8  
Old July 28th 09, 04:32 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Creating a Task with VBScript

Sorry, but I don't understand what you mean by "appears my custom form as a
contact element."

The Activities tab does an on-demand search each time you use it, which can
be quite slow, depending on how many folders are included in the selected
activity group. Maybe you just need to wait longer for the search to
complete.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"yannickestrada" wrote in message
...
Thanks Sue, that works.

But know I had 2 problems. The task doesn´t appear in the Activities tab
like I expected, instead appears my custom form as a contact element.

The other problem is that the elements in Activities tab sometimes appears
sometimes not. Why is that? I use Outlook 2007.

Regards

"Sue Mosher [MVP]" wrote:

Here's another idea: Try saving the item before you call Links.Add

"yannickestrada" wrote in
message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.

"Ken Slovak - [MVP - Outlook]" wrote:

Item should work if the item is a contact item. Form code is VBScript,
so
it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

"yannickestrada" wrote in
message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with
Item?

Regards.







  #9  
Old July 28th 09, 06:22 PM posted to microsoft.public.outlook.program_vba
yannickestrada
external usenet poster
 
Posts: 13
Default Creating a Task with VBScript

Sorry Sue, that was ocurring when I run the code in a VBA project.

My code looks like this:

Set myTask= Application.CreateItem(3)
myTask.Subject = "Subject"
myTask.DueDate = #17/09/2009#
myTask.Save

Item.Save

Set colLinks = myTask.Links
Set oLinks = colLinks.Add(Item)

Now the Add function isn´t the problem. I checked the colLinks count and the
add is happening, but I never see the task in the Activities tab.

Thanks.

"Sue Mosher [MVP]" wrote:

Sorry, but I don't understand what you mean by "appears my custom form as a
contact element."

The Activities tab does an on-demand search each time you use it, which can
be quite slow, depending on how many folders are included in the selected
activity group. Maybe you just need to wait longer for the search to
complete.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"yannickestrada" wrote in message
...
Thanks Sue, that works.

But know I had 2 problems. The task doesn´t appear in the Activities tab
like I expected, instead appears my custom form as a contact element.

The other problem is that the elements in Activities tab sometimes appears
sometimes not. Why is that? I use Outlook 2007.

Regards

"Sue Mosher [MVP]" wrote:

Here's another idea: Try saving the item before you call Links.Add

"yannickestrada" wrote in
message
...
Same error. I don´t know what is the problem, because the Item is like
Item.Contact.MyForm, that should work.

Thanks again.

"Ken Slovak - [MVP - Outlook]" wrote:

Item should work if the item is a contact item. Form code is VBScript,
so
it
only has Variant objects and you can't create a ContactItem reference.

Does it work if you use it as a function:

Set colLinks = myTask.Links
Set oLink = colLinks.Add(Item)

"yannickestrada" wrote in
message
...
I get the error when I call: colLinks.Add(Item)



"yannickestrada" wrote:

Thanks I was traying to do the opposite.

But my new code doesn´t seems to work neither.

Set myTask = Application.CreateItem(3)
myTask.Subject = "..."
myTask.DueDate #17/08/09#

myTask.Save

Set colLinks = myTask.Links
colLinks.Add(Item)

How I get the current form as a ContactItem is not enough with
Item?

Regards.








 




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
Help Desk and Assigned Help Task Sample not creating task on cliK doc4a Outlook - Using Forms 0 July 16th 08 09:47 PM
Task Form will not run VBScript when published to production mailb Tony the Techie Outlook - Using Forms 1 July 23rd 07 12:21 PM
Creating a link to an e-mail in a task [email protected] Outlook and VBA 1 November 14th 06 06:03 AM
Creating public calendars in vb or vbscript. [email protected] Outlook and VBA 13 July 7th 06 10:24 PM
Help with importing a creating contact list using vbscript John Connor Outlook - Using Contacts 1 April 27th 06 08:11 AM


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