Results 1 to 2 of 2
  1. #1

    Creating Outlook Task from Word (Word 97/2000, Outlook 98)

    As part of a larger project I'm trying to create a piece of code that will automatically create and save an Outlook task item corresponding to a due-date entry in a Word form and with the title or subject of the active Word document also being the Subject of the Outlook task.
    I've come up with the following snippet of code which will do the trick from Word to Outlook 2000 on my own machine running Windows 98 (provided strDueDate has a value):

    Public Sub Create_Task()
    Dim strTitel as String
    Dim strDueDate as String
    strTitel = ActiveDocument.BuiltInDocumentProperties(wdPropert ySubject)
    Selection.Font.Bold = True
    Selection.TypeText Text:=strDueDate
    Selection.Font.Bold = False
    Dim objOl As Object
    Set objOl = CreateItem(olTaskItem)
    objOl.Subject = strTitel
    objOl.DueDate = strDueDate
    Set objOl = Nothing
    End Sub

    From Word to Outlook 98 which I'm using at work on an NT 4.0 platform, I'm still without any luck in creating alternative code to accomplish the same. The CreateItem is not part of the Outlook 98 model as far as I have discovered.

    Does anyone have an idea for an alternate approach to achieve the same ends?

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Burwash, East Sussex, United Kingdom
    Thanked 187 Times in 173 Posts

    Re: Creating Outlook Task from Word (Word 97/2000, Outlook 98)

    Hi Thomas,
    I don't have OL98, but according to the MSDN library it does have a CreateItem method - they list this code:
    Set ol = New Outlook.Application
    Set MyItem = ol.CreateItem(olMailItem)
    so I assume this would work with taskitems too. Are you getting an error or does it simply not do anything?

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts