Convert export calendar to Outlook to late binding

Hi

I have adapted code by Helen Feddema to export calendar items to outlook 
using early binding. It works perfectly but the database is multi-user  & not 
all users have Outlook - Novell Groupwise is used instead by these users.

So the problems are as follows:
1. Users without Outlook installed do not have the Outlook Reference library 
file msoutl.olb so they get an error at start up. Will this be fixed if I 
just copy this file to their computers along with the database front-end 
....or do I need to register this on this machine also?

2. If the above suggestions won't work, how can I convert the code to use 
late binding - the main part of the code is listed below - apologies fir its 
length

3. Does anyone know how to export the data into a Groupwise calendar for 
users who use that instead of Outlook?  There are various Groupwise reference 
library files available in Access but I don't know where to start...

======================================
Code using early binding:

Option Compare Database
Option Explicit

   Dim dbs As Database
   Dim rst As Recordset
   Dim appOutlook As New Outlook.Application
   Dim itm As Outlook.AppointmentItem
   Dim rcp As Outlook.Recipient
   Dim strContactName As String
   Dim strFolder As String
   Dim nms As Outlook.NameSpace
   Dim flds As Outlook.Folders
   Dim blnFound As Boolean
   Dim fld As Outlook.MAPIFolder
   Dim itms As Outlook.Items
   Dim appt As Outlook.AppointmentItem
   Dim lngCount As Integer
   Dim strTitle As String
   Dim strDateFilter As String
  
-------------------------------------------------------------------------------------------------
Public Sub CheckOutlook()

'check if Outlook is installed (v2002 to 2010)
If FileOrDirExists("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") 
= False Then 'Outlook 2003
    If FileOrDirExists("C:\Program Files\Microsoft 
Office\OFFICE12\OUTLOOK.EXE") = False Then 'Outlook 2007
        If FileOrDirExists("C:\Program Files\Microsoft 
Office\OFFICE14\OUTLOOK.EXE") = False Then 'Outlook 2010
            If FileOrDirExists("C:\Program Files\Microsoft 
Office\OFFICE10\OUTLOOK.EXE") = False Then 'Outlook 2002
                MsgBox "You cannot do the export as Outlook is not 
installed" & _
                " on this computer      ", vbCritical, "Export to Outlook"
                Exit Sub
            End If
        End If
    End If
End If

End Sub

--------------------------------------------------------------------------------------------------
Public Sub ExportTimetableCalendar()

On Error GoTo ErrorHandler

'Check if Outlook is installed on the user's computer
CheckOutlook

'Explain routine to user
    strMsg = "This routine will export timetable & calendar items to Outlook 
    " & vbNewLine & vbNewLine & _
    "A new folder RMPCalendar will be created in Outlook if it does not 
already exist " & vbNewLine & vbNewLine & _
    "NOTE: All existing items in thnis folder will be replaced to avoid 
duplication       " & vbNewLine & vbNewLine & _
    "Are you sure you wish to run this routine?"

    strTitle = "Export timetable & calendar?"

    If MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, strTitle) 
= vbNo Then Exit Sub

'check type of export required - rest of academic year (default) or whole 
academic year
    strMsg = "Choose which events to export " & vbNewLine & _
    "===================" & vbNewLine & vbNewLine & _
    "Click YES to export future events for the rest of the academic year 
only (RECOMMENDED)       " & vbNewLine & _
    "Click NO to export ALL events for the whole academic year   " & 
vbNewLine & _
    "Click CANCEL to exit this routine"

    strTitle = "Choose export events required"
    
    Select Case MsgBox(strMsg, vbYesNoCancel + vbExclamation, strTitle)
        Case vbYes
            strDateFilter = " AND SchCalendar.DayDate >=Date()" 'future 
events only (default)
        Case vbNo
            strDateFilter = "" 'all events for current academic year
        Case vbCancel
            Exit Sub 'abort routine
    End Select
    
    'Define Outlook folder & set up items
    strFolder = "RMPCalendar"
   'strFolder = "Calendar"
   
   Set nms = appOutlook.GetNamespace("MAPI")
   Set flds = nms.Folders("Personal Folders").Folders
   Set nms = appOutlook.GetNamespace("MAPI")
  
   'Check for existence of RMPCalendar folder and create it if not found
   blnFound = False
 
  'Open Outlook
   Set appOutlook = GetObject(, "Outlook.Application")
   
   'Set appOutlook = CreateObject("Outlook.Application")
       
   For Each fld In flds
        If fld.Name = strFolder Then
            blnFound = True 'RMPCalendar folder exists
            fld.Delete 'so delete it so it will be recreated
            blnFound = False
        End If
   Next fld

   If blnFound = True Then
      Set fld = flds(strFolder)
   ElseIf blnFound = False Then
      Set fld = flds.Add(strFolder, olFolderCalendar)
   End If
  
   Set itms = fld.Items
   
   'Get reference to data table
   Set dbs = CurrentDb
   
'run the exports

DoCmd.Hourglass True

ExportTeacherTimetable

DoCmd.Hourglass False

MsgBox "Timetable & Calendar exported successfully.  ", vbInformation

ErrorHandlerExit:
   Exit Sub
 
ErrorHandler:
    If err.Number = 429 Then 'Outlook is not running; open Outlook with 
CreateObject
      Set appOutlook = CreateObject("Outlook.Application")
      Resume Next
    End If

    If err.Number = -2147467259 Then
        MsgBox "You need to have a Personal Folders (PST) file in Outlook 
for the export to work successfully.    " & vbNewLine & _
        "Please create this file in Outlook before you run this routine 
again    ", vbCritical, "Export failed!"
    Else
        MsgBox "Error No: " & err.Number & "; Description: " & err.Description
    End If
   Resume ErrorHandlerExit
   
End Sub

---------------------------------------------------------------------------------------------

Public Sub ExportTeacherTimetable()

On Error GoTo ErrorHandler

   'Create recordset for teacher timetable based on event date choice 
(strDateFilter)
   strSQL1 = "SELECT qryTimetable.Lesson, [DayDate] & ' ' & [StartTime] AS 
DateStartTime," & _
    " [DayDate] & ' ' & [EndTime] AS DateEndTime, qryTimetable.ClassID, 
qryTimetable.TeacherID, qryTimetable.RoomID" & _
    " FROM (qryTimetable INNER JOIN SchDay ON qryTimetable.Period = 
SchDay.LessonID)" & _
    " INNER JOIN SchCalendar ON (qryTimetable.Day = SchCalendar.SessionDay)" 
& _
    " AND (qryTimetable.WeekNumber = SchCalendar.WeekNumber)" & _
    " WHERE ((qryTimetable.TeacherID = GetLoggedOnTeacher()) " & 
strDateFilter & ")" & _
    " ORDER BY SchCalendar.DayDate, qryTimetable.LessonID;"

   'Debug.Print strSQL1
   
   Set rst = dbs.OpenRecordset(strSQL1)
       rst.MoveLast
       rst.MoveFirst
       lngCount = rst.RecordCount
   'Debug.Print lngCount
   
   'Loop through table, exporting each record to Outlook
   Do Until rst.EOF

      'Create an appointment item
      Set appt = itms.Add("IPM.Appointment")

      With appt
         .Subject = Nz(rst![ClassID])
        '.Categories = Nz(rst![Category])
         .Start = Nz(rst![DateStartTime])
         .End = Nz(rst![DateEndTime])
         .AllDayEvent = False
         .Location = Nz(rst![RoomID])
         .ReminderMinutesBeforeStart = 20
         .ReminderOverrideDefault = True
         .ReminderPlaySound = True
         .ReminderSet = True
         .ReminderSoundFile = "C:\Windows\Media\notify.wav"
    
         .Close (olSave)
      End With
      rst.MoveNext
   Loop
   rst.Close

ErrorHandlerExit:
   Exit Sub
 
ErrorHandler:
   MsgBox "Error No: " & err.Number & "; Description: " & err.Description
   Resume ErrorHandlerExit
 
End Sub

0
Utf
6/5/2010 10:21:43 PM
access 16762 articles. 2 followers. Follow

0 Replies
1152 Views

Similar Articles

[PageSpeed] 46

Reply:

Similar Artilces:

Newsgrups in Office Outlook
Can I use my Microsoft Outlook [office 2000 SR 1] to reading and revewing Internet news groups? How to set it up? As for now I have to review news in my Outlook Expres, but it would be nice to use only one program. Thank you for any help! -- Outlook is not a news reader. It invokes OE or whatever news reader is your default. -- Russ Valentine [MVP-Outlook] "Polikarp_1973" <simmias@poczta.onet.pl> wrote in message news:ch48hs$e4p$1@news.onet.pl... > Can I use my Microsoft Outlook [office 2000 SR 1] to reading and revewing > Internet news groups? > How to set i...

CAN'T SEND EMAIL IN OUTLOOK #2
I downloaded some updates from microsoft and, if I open a site and click on "file" then 'send to", instead of the "send" button, I get a message "email blocked because of attachment". How can I get rid of OUTLOOK so that I can just use my simple OE6? Simple, you stop using outlook and set up / configure OE To be doubly sure you can uninstall OL "XJS FAN" <XJSFAN@discussions.microsoft.com> wrote in message news:E4F862BA-FFFC-4B41-A59B-2BDDA895B9B6@microsoft.com... >I downloaded some updates from microsoft and, if I open a site and...

How to Convert UTC to localTIme(C# )
I have got the value of user account's lastlogon time. Its type is Int64. This value is stored as a large integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC)(Refer to MSDN). I don't know how to convert this value to localTime. The following is my code. ################################################################ DirectoryEntry deUser = new DirectoryEntry(ldappath); DirectorySearcher src = new DirectorySearcher(deUser); src.Filter = "(&(objectClass=user)(SAMAccountName=" + accountNa...

How can I export email from Entorage back to Outlook?
I have a user who tried a Mac for 8 months and she is not happy with it. She has moved back to Windows XP and Office 2003 and I need to get all of her mail from Entourge back into either Outlook or Outlook express. I have only seen the option to export contacts not mail. Anyone have a clue at how I can accomplish this? ...

Outlook 2003: Attachment Icon doesn't print
All users in a subsidiary office share this attachment icon problem: they see the paper clip in the attachment field prior to opening the e-mail message, and they also see the icon in the opened e-mail (sometimes located below the subject line in the heading, and sometimes located in the body of the e-mail). When they print the message, the icon fails to appear. It will print when you print the message in Plain Text. For HTML it will be fixed in SP1 which is coming soon! -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and Restore -Create an O...

Convert text to time value
I have a series of time values in a 'General' format. They are of the type: 184525 Which is 18:45:25 or 6:45:25 pm. A time which is am would be of the type: 12345 Which is 1:23:45 am. Is there a way to convert those 'General' values to an Excel serial so that I can figure out the difference between two times? I've seen a bunch of examples on the net, but none of those that I have found deal with this format that I can tell. Thanks. Hi try =--TEXT(A1,"00:00:00") -- Regards Frank Kabel Frankfurt, Germany "Andy" <amelton@gmail.com> schrieb...

how to convert date
Hi, I'm looking for some method to convert mail date, in format: eg. "Sun, 18 Sep 2005 20:57:08 +0200", to computer local time. I tried CTime but without resoults. m. Have you tried COleDateTime::ParseDateTime()? m.wski21.usunto@aust.com wrote: > Hi, > > I'm looking for some method to convert mail date, in format: > eg. "Sun, 18 Sep 2005 20:57:08 +0200", to computer local time. > I tried CTime but without resoults. > > m. >I'm looking for some method to convert mail date, in format: >eg. "Sun, 18 Sep 2005 20:57:08 +0200&qu...

Outlook does not Open!
Outlook takes a while to open then quits after error message. Same is happening with Internet @ MSN Explorer. Version of Outlook? Exact error message? Anything else relevant to this you would like to share? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and Restore -Create an Office XP CD slipstreamed with Service Pack 3 ----- "Sal" <anonymous@discussions.microsoft.com> wrote in message news:26dfa01c4630d$a40e9400$a501280a@phx.gbl... > Outlook takes a while to open then quits after error > message. Same is happening with Inter...

Cannot locate Outlook
I cannot locate "Outlook" anywhere. I'm using Vista and have a registered Home and Student 2007. Outlook was there a few days ago, not now. I use Vista and IE & OE. A friend asked for help with Outlook. I opened it a few days ago to look it over. Yesterday I could not find it in the Office suite drop down list or anywhere. Where do I find it? -- richard "Richard" <richard1@nospam.net> wrote in message news:3AC644E7-15ED-445C-B63B-307D46EA60AF@microsoft.com... > I cannot locate "Outlook" anywhere. I'm using Vista and have a re...

Outlook 2007 Voice Access
Hello, Exchange 2007 SP1, Outlook 2007 SP2. We disabled the functionnality of Outlook Voice Access (OVA) to play e- mail messages on the phone - and limited it only to listen to voice messages. But we just noticed that when you disable this e-mail reading feature, OVA does not tell you how many NEW voice messages you have in your mailbox (they have not been read in Outlook and are still marked as unread). You can however continue and listen to them. So for me the TUIAccessToEmailEnabled PowerShell command set to $false also prevents knowing how many NEW voice messages we have...

Excel: Auto converting text to numbers
I am downloading an Excel sheet, and the numbers come in as text. It basically comes in as "33 %" but Excel registers this as text, not a percentage. I have a cell that will be used to add the numbers, but since they are text it doesn't work. Given this information, is there a way to convert the imported data into numbers. I would prefer to include this into my formula. The potential numbers are: 0, 1, 2, 3, 4, 0 %, 25 %, 33 %, 50 %, 67 %, 75 %, 100 %, and N/A I would prefer a function, again if possible, that could convert any number. Please note, the space between the nu...

How do I convert dates to text keeping the format?
I'm trying to convert a column of data in date format *m/d/yyyy to a text format without converting to serial numbers. Ie: I want to retain the mm/dd/yyyy format. Is there a way to do this? =TEXT(A1,"MM/DD"/YYYY") "sprlarry" <sprlarry@discussions.microsoft.com> wrote in message news:69669AA6-FD15-47D7-843D-FC768728BF7A@microsoft.com... > I'm trying to convert a column of data in date format *m/d/yyyy to a text > format without converting to serial numbers. Ie: I want to retain the > mm/dd/yyyy format. Is there a way to do this? That ...

Scheduled mail with outlook
Can outlook 2003 sent out a specific email every week on a specific time? shon <nomail@isp.nl> wrote: > Can outlook 2003 sent out a specific email every week on a specific > time? Yes, with some scripting. See http://www.outlookcode.com/d/forms/skedrpt.htm -- Brian Tillman ...

How To Pre-Define Username Settings For Outlook 2003 Client In Roaming Profiles
I have a generic default user profile that is setup for our organization and lives in the netlogon share. Whenever I make changes to the roaming profiles I delete the users profiles and they get a new copy of the default user profile to call their own when they next log on. My problem is that I cannot figure out how to have Outlook 2003 auto-setup for the users. In Outlook 2000 I could simply setup the profile up without a username and then make that profile available to them. When they logged in and acquired a copy of the profile, the missing username field in Outlook, auto-populated with...

Some wat to change Outlook's importing rules for contacts?
When I import files to Outlook's contacts, the "File As" seems to default to the Name. This is fine when there is no Company, but when there is a Name and a Company I'd rather have the "File As" default to the Company. Is there any way to make this happen without (as I have been doing) manually going through the contacts and editing them? ...

how to convert excel's .cvf file to .csv file
...

OutLook 2003 SP1
Dear all, I've a problem with my medium-sized PST (1.1Gb, local hard drive). When I try to move message from this PST to another local PST (old_messages_04) I got this error message: "Can't move the items. The item could not be moved. It was either already moved or deleted, or access was denied". ScanDisk corrected some issue on PST files, and I already ran SCANPST.exe, but I got the same error. Could you help me? Did you've any site/links to follow? I altrady tried to look for help on internet unsuccesfully. Any help will be appreciated. Thanks a lot in advance ...

Convert Access97 to 2000
Hello, we're currently running access97 and would like to convert it to 2000, but we don't know what is the administrator password for this database. Also this database is running on multi user and have difference permission for diffence users. Could someone help me how to do make this happen but keep the currently permission retaint. Thanks ...

error in outlook
I was wondering if any body is had an issue with oulook regarding the following error "OUTLOOK IS OUT OF SYSTEM RESOURCES", following by a Dr. Watson error. Dr. Watson error OUTLOOK.exe Exception: access violation (0x0000005), Address: 0x04c9bb30 The system is a NT box with 10GB HD, 128MB RAM and 433MHz cpu. This error ocurrs evey now and then it is not constantly happning. Usually is whil working in outlook. I hope some-one can help me. Thanks ...

Outlook shutdown problem #2
Outlook hangs up when I shut it down. I can not restart it unless I use the task manager to abort it. I use microsoft exchange server. I ran scan OST and scan PST to fix all the problems - Still hangs up. Sailor <anonymous@discussions.microsoft.com> wrote: > Outlook hangs up when I shut it down. I can not restart > it unless I use the task manager to abort it. > > I use microsoft exchange server. I ran scan OST and scan > PST to fix all the problems - Still hangs up. http://www.howto-outlook.com/Faq/outlookdoesntclose.htm -- Brian Tillman ...

Public folder calendar issue
Hi I have just installed exchange server in my organisation. Every one has exchange server type account. I have installed this just for using public folder. In public folder I have calendar and task items. Employees, enters their active task and and important things to be shared on the calendar. However, their names does not reflect on the calender it just shows the subject line, so with so many entries in the calendar, how will employees know whose entry is whose and who is on leave? In news:O3a8gZy0GHA.4796@TK2MSFTNGP06.phx.gbl, nishad <sos.tech.sos@gmail.com> typed: > Hi I have...

Convert 2000 Calendar to web page
Greetings, When I convert my calendar for 2005 to a webpage, the page is off by 1 day. Is there a template or fix available to fix this? Thanks, Duane I can edit the html file but this should not be the case. Fixes? Suggestions...other than use Apple? "Duane Perry" <dlp_sr@yahoo.com> wrote in message news:yZRtd.5561$0r.1710@newsread1.news.pas.earthlink.net... > Greetings, > > When I convert my calendar for 2005 to a webpage, the page is off by 1 day. > Is there a template or fix available to fix this? > > Thanks, > > Duane > > Duane, ...

outlook 2003 #93
we are a tax accounting firm and we are using Outlook 2003. However the various accounts are losing their appointments. We are running exchange server and windows 2000 server. we have 4 accountants and apx 10 employees at this time of year all using outlook 2003. in the off season we don't loose any client appointments could it be possible that the program is being overloaded. I find my self manually deleting the active directory event log almost everyday. someone please give me some suggestion or possiblities for this problem. I'm not sure about Outlook 2003 but in past ...

XML Note convert to DataSet
Hello, I have this function: object acmResponse = acmLogin.acmString("4001", "", paramFormLogin + paramUserBasics);System.Xml.XmlNode[] acmNodes = (System.Xml.XmlNode[])acmResponse; What I have todo, to convert the XML Object in the DataSet Object? Thank you Matthias ...

How do I set outlook 2003 to always switch to HTML in replies?
I receive e-mails from someone on a regular basis who is using Outlook 2003 on an exchange 2003 server. Often when I want to reply the e-mail is set to TXT and I want to reply html. I have to switch it manually each time. Is there a way to make it autoreply HTML without switching each time? Thanks "boe" <boe_d@dontspamhotmail.com> wrote in message news:uVKUXV02GHA.4748@TK2MSFTNGP04.phx.gbl... >I receive e-mails from someone on a regular basis who is using Outlook 2003 >on an exchange 2003 server. Often when I want to reply the e-mail is set >to TXT and I...