Solved

BlueDevils' Distribute Outlook Holidays Script

Posted on 2008-10-31
3
672 Views
Last Modified: 2012-06-21
I copied and pasted into notepad and made changes as you mentioned in your last post. However, when I ran the script I received the following error:
c:\outlook_holiday.vbs(12, 5) Microsoft Office Outlook: Type Mismatch: Unable to coerce parameter value. Outlook cannot translate your string.

I'm not a programmer but I looked at the script to see if I could see any problem but, of course, I wasn't. I've pasted in my entire script below. Any help would be very much appreciated.

Thanks,

Chris


Dim olkApp, olkCalendar, olkEvent, arrEvents, arrItem, varEvent
arrEvents = BuildEventList()
Set olkApp = GetObject(,"Outlook.Application")
If TypeName(olkApp) <> "Application" Then
      Set olkApp = CreateObject("Outlook.Application")
End If
Set olkCalendar = olkApp.GetNamespace("MAPI").GetDefaultFolder(9)
For Each varEvent in arrEvents
    arrItem = Split(varEvent, ":")
    Set olkEvent = olkApp.CreateItem(1)
    olkEvent.Subject = arrItem(0)
    olkEvent.Start = arrItem(1)
    olkEvent.AllDayEvent = True
    olkEvent.ReminderSet = False
    olkEvent.Save
Next
Set olkEvent = Nothing
Set olkCalendar = Nothing
Set olkApp = Nothing
WScript.Echo "Events Added"
 
Function BuildEventList()
    'Change 5 to the number of events in your list minus one.  For example, if you have 10 events in your list, then the number would be 9.
    Dim arrTemp(10)
    'Add a line like the following for each event.  Arrays start at 0 not 1.  The events can be in any order.  The format is Event:Date.
    arrTemp(0) = "New Year's Day:/1/1/2009"
    arrTemp(1) = "Presidents' Day:2/16/2009"
    arrTemp(2) = "Memorial Day:5/25/2009"
    arrTemp(3) = "Day before Independence Day:7/2/2009"
    arrTemp(4) = "Independence Day:7/3/2009"
    arrTemp(5) = "Labor Day:9/7/2009"
    arrTemp(6) = "Thanksgiving Day:11/26/2009"
    arrTemp(7) = "Day after Thanksgiving:11/27/2009"
    arrTemp(8) = "Winter Holiday:12/25/2009"
    arrTemp(9) = "Winter Holiday:12/26/2009"
    arrTemp(10) = "New Years Eve:12/31/2009"
    BuildEventList = arrTemp  
End Function

0
Comment
Question by:tcups
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 250 total points
ID: 22856442
Hello tcups,

You have a superfluous '/' character, change the first datum of your buildeventlist from

    arrTemp(0) = "New Year's Day:/1/1/2009"

to
    arrTemp(0) = "New Year's Day:1/1/2009"

Regards,
Chris
0
 

Author Closing Comment

by:tcups
ID: 31512220
Thanks for the help. I appreciate it.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22870856
You're welcome and thanks for the grade.

Chris
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question