Solved

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

Posted on 2006-11-29
3
382 Views
Last Modified: 2008-03-17
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
Comment
Question by:Andy Brown
  • 2
3 Comments
 
LVL 84
ID: 18036891
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
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 18036940
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
 

Author Comment

by:Andy Brown
ID: 18037008
Perfect - thank you very much (again)

Really appreciated.

All the best.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

773 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