• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

Access + Outlook + Late Binding - Saving an appointment rather than displaying it.

Hi All,

I am slowly getting to grips (thanks to EE), with using Late binding to Outlook via MS Access 2003.  However, I can't solve one final issue.

My application currently allows the user to email an appointment, stored in the Access database, as a VCalendar to who ever needs it.  Using early binding this works fine using the following code:

With objRem
  'Field population goes here

  .SaveAs "C:\Foldername\Filename.vcs", olVCal
End with


I then create an email and attach this file.  For some reason I cannot use the olVCal part when using late binding.

Any ideas?

All the best
0
Andy Brown
Asked:
Andy Brown
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
When using Late Binding the constants associated with the library won't be available unless you make them so. The easiest way to do it is to determine the acutal value of those constants and declare them in a Standard Module in your database:

Public Const olVCal As Long = 1
Public Const olVSomeotherValue As Long = 2

etc etc.

You can determine the value of your constants by remaking a reference to the Outlook library and then use the Object Browser to locate the constants you need.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
As an example, the value of olVCal is 7, so you'd need to do this:

Public Const olVCal As Long = 7

Other members of this enumaration (which is named OLSaveAsType) are:

olDoc =4
olHTML = 5
olCal = 8
olMHTML = 10
olMSG = 3
omMSGUnicode = 9
olRTF = 1
olTemplate = 2
olTXT = 7
olVCard = 6

The ONLY trouble with this approach is if Microsoft were to change the value of a constant ... say they decided, in Outlook 23, to change the value of olVCal to 122 ... if this were to happen, then your code would fail IF it were run on a machine with Outlook 23 installed. That said, the constant values almost never change (I can't recall an instance where they did), so your constant declarations should work fine.
0
 
Andy BrownAuthor Commented:
Perfect - thank you very much (again)

Really appreciated.

All the best.
0

Featured Post

Technology Partners: 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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now