Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    macros in outlook (2003)

    On a previous post I asked for some assistance with developing a macro to create an outlook email using a template which has all the information such as 'addressees, categories, special titling etc'. Once I discovered the benefits of the templates I applied it to tasks and attempted to do the same with calendar meetings .... that's where I came unstuck. For some reason the outlook calendar macro does not work. I have attached the other macros for interest.

    Can someone help me out with the error in the macro for creating calendar appointments. I suspect it will be something simple?

    Sub Meeting1()
    Dim msg As Outlook.MeetingItem
    Set msg = CreateItemFromTemplate("Cocuments and SettingsusernameApplication DataMicrosoftTemplatesMeeting1.oft")
    msg.Display
    Set msg = Nothing
    End Sub

    The below macros work

    Sub test_mail()
    'email template for
    Dim msg As Outlook.MailItem
    Set msg = CreateItemFromTemplate("Cocuments and SettingsusernameApplication DataMicrosoftTemplatestest_mail.oft")
    msg.Display
    Set msg = Nothing
    End Sub

    Sub Task1()
    Dim msg As Outlook.TaskItem
    Set msg = CreateItemFromTemplate("Cocuments and SettingsusernameApplication DataMicrosoftTemplatesTask1.oft")
    msg.Display
    Set msg = Nothing
    End Sub

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: macros in outlook (2003)

    Try declaring it as an AppointmentItem:

    Dim msg As Outlook.AppointmentItem

    Also, when you have code problems, it's helpful to tell the Loungers what the error is and what line it occurs on. Post back if this doesn't help.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macros in outlook (2003)

    Thanks John - your solution worked a treat.

    For other's information, the error was 'run-time error 13'.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: macros in outlook (2003)

    Claude, more precisely the error message text was "Type mismatch" and that tells us that the variable type declared and the variable type created are not the same type, which lead me fairly quicky to diagnose your issue. (Sorry, I'm not picking on you here, just trying to help you understand what the error means and the reason it will help other Loungers.)
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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