Solved

Exporting or Backing up Calendar

Posted on 2006-06-22
11
908 Views
Last Modified: 2008-02-01
I'm looking for a macro or add-in to automate the export (backup) of Calendar.  Our lead chemist keeps retest dates in Calendar and some are 3 - 6 months out and others 24 - 36 months.  I suggested the MS Outlook Backup utility but he wants to secure only the Calendar data and the utility backs up the entire Personal Folder.  I also suggested creating a seperate folder and just keeping the Calendar data current, but he's convinced me that's too complicated for a chemist  ;>)
0
Comment
Question by:paulawest
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 97

Expert Comment

by:war1
ID: 16962968
Greetings, paulawest !

Here is how to export or backup Outlook Calendar
http://technology.iusm.iu.edu/TimeZoneDoc/CalendarBackup.pdf 

1. Open OUTLOOK
2. Select “Calendar”
a. Choose from selection at lower left. Or, from the GO drop down menu
3. Click on the FILE drop down menu. . .
Then, Click on “Import and Export . . .”
(if you don’t’ see the “Import and Export…”, move the mouse pointer to the down arrows
to expand the drop down list.)
4. Select “Export to a file”
5. Click NEXT
6. Select “Personal Folder File (.pst)”
7. Click NEXT
8. Click on “CALENDAR” so it is highlighted
9. Click on the box marked “Include Subfolders” so the check mark appears.
10. Click NEXT
11. Under “Save Export file as . . .” Type “P:\calbackup.pst” (without the quotation marks)
12. Click Finish
13. Click OK
Best wishes!
0
 

Author Comment

by:paulawest
ID: 16963183
Thanks War1, I had seen that during my initial research so what I was wondering was if the same thing could be accomplished via macro or add-in, (maybe to fire when closing Outlook)  and whether someone had written such.
0
 
LVL 97

Expert Comment

by:war1
ID: 16963238
Paulawest,

I do not know of an addin.  Maybe someone else knows of a macro that will do what you want.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 76

Expert Comment

by:David Lee
ID: 16963873
Hi paulawest,

Such a macro is pretty simple so long as we're talking about copying and not synchronizing.  If it's a straight copy, then let me know and I'll post the code.

Cheers!
0
 

Author Comment

by:paulawest
ID: 16963995
Exactly!  The goal, of course, is to be able to recover the Calendar data in the event of PC loss or migration.  I am curious though about copy vs. export to file such as referenced above.  Regardless, any code assist is greatly appreciated!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16964887
Ok.  I'll get the code posted shortly.  There is no difference between copy and export if you're considering the final product: a copy of the folder.  There's a big difference though in the steps required.  War1 listed the steps for exporting above.  Using a code based solution we can those 13 steps down significantly, perhaps even to a single button click.  
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16965443
Here's the code for doing this.  Follow these instructions to set the code up and use it.

1.  Open Outlook.
2.  Click Tools->Macro->Visual Basic Editor.
3.  If it's not already expanded, expand Modules and click on Module1.
4.  Copy the code I posted and paste it into the right-hand pane of the Visual Basic Editor.
5.  Edit the code.  I placed comments where things need to or can be changed.
6.  Click the diskette icon to save the change.
7.  Exit the Visual Basic Editor.
8.  Click Tools->Macro->Security.
9.  Change the Security Level to Medium.
10. Run the code.  It will prompt the user for the name of a PST file to back the calendar up to.  If not file name is entered, then nothing is done.  If a file name is entered, then the code will create a PST file, copy the contents of the calendar to the PST file, and close the PST file.  I wrote and tested this using Outlook 2003.  

Sub ExportCalendar()
    Dim olkNS As Outlook.NameSpace, _
        olkSourceCalendar As Outlook.Items, _
        olkExportCalendar As Outlook.MAPIFolder, _
        olkSourceItem As Outlook.AppointmentItem, _
        olkExportItem As Outlook.AppointmentItem, _
        olkTempFolder As Outlook.MAPIFolder, _
        strPSTFileName As String, _
        strMacroName As String
    strMacroName = "ExportCalendar"
    'Change the default path and file name on the following line
    strPSTFileName = InputBox("Enter the file path and name of the PST file to export the calendar to.", strMacroName, "C:\eeTesting\Calendar Backup.pst")
    If strPSTFileName <> "" Then
        Set olkNS = Application.GetNamespace("MAPI")
        olkNS.AddStore strPSTFileName
        Set olkTempFolder = olkNS.Folders.GetLast
        'Change the PST file's display name on the following line if desired
        olkTempFolder.Name = "Calendar Backup"
        'Change the name of the folder in the PST file if desired
        Set olkExportCalendar = olkTempFolder.Folders.Add("Calendar", olFolderCalendar)
        Set olkSourceCalendar = Session.GetDefaultFolder(olFolderCalendar).Items
        For Each olkSourceItem In olkSourceCalendar
            Set olkExportItem = olkSourceItem.Copy
            olkExportItem.Move olkExportCalendar
        Next
        olkNS.RemoveStore olkTempFolder
    End If
    Set olkTempFolder = Nothing
    Set olkExportItem = Nothing
    Set olkSourceItem = Nothing
    Set olkExportCalendar = Nothing
    Set olkSourceCalendar = Nothing
    Set olkNS = Nothing
    MsgBox "Export complete!", vbInformation + vbOKOnly, strMacroName
End Sub
0
 

Author Comment

by:paulawest
ID: 16965594
Excellent!!

As far as what fires this, can an average VB coder add the code to fire this when Outlook closes or some other event?  I can't thank you enough for the help!
0
 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 16967385
If they know Outlook's object model, then yes.  To save you a little time, here's the code for firing this each time Outlook exits.  This code has to go in the module ThisOutlookSession.

Private Sub Application_Quit()
    ExportCalendar
End Sub


You're welcome.  Glad I could help out.
0
 

Expert Comment

by:greep
ID: 20175279
Hello,

I would like to know if it is possible to modify this macro, so that the calendar is exported and saved as a .htm file (for only 1 month - start date would be the current date) for use on the web?

Many thanks.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20182412
Hi, greep.

Probably, but it'd require a lot of work.  There is no command in Outlook for exporting a calendar to HTML like the "Save as Web Page" menu selection.  You'd have to script the whole thing from scratch.  It's doable, but it'll require a good bit of scripting beyond what I posted here.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

839 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