Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Exporting or Backing up Calendar

Posted on 2006-06-22
11
Medium Priority
?
962 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
[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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Changing a few Outlook Options can help keep you organized!
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

618 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