UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access 2016: Where Is Outlook 14.0 Reference Library?, Access 2016    
 
   
karenedmonds
post Jul 11 2017, 09:30 PM
Post#1



Posts: 351
Joined: 2-August 11
From: Melbourne, Australia


Hi there! Hoping you can help me (struggling lay person) ....

I have been using the following code for quite some time successfully - to send appointments to Outlook.
This code was originally used in an Access 2010 database.
We then upgraded to Access 2016 and it seemed to work fine ... until an overhaul of our computer system this week (ie. server update).

I know when originally creating this form, I had to reference to the Outlook 14.0 library, but I can no longer see this option available in the VBA references.
I have tried to browse through available Office 14 files, but can't seem to find the right one.

Could you please advise how I adapt the code to fit the 16.0 reference, or any other suggestions??

Error is: 2147418113 Automation Error: Catastrophic Failure.
The debug highlights: Set outobj = CreateObject("outlook.application")

Many thanks, as always, appreciated.


Private Sub AddAppt_Click()
On Error GoTo AddAppt_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if apointment has been added to Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment has already been added to Outlook"
Exit Sub
'Add a new appointment.
Else
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application")
Dim olFolder As Outlook.Folder
Set olFolder = outobj.GetNamespace("Mapi").Folders("office@marshallrestorations.com.au").Folders("Calendar")
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt & " " & Me!Text62 & " " & Me!Text74
.Location = Me!Text71 & " " & Me!ApptLocation & " " & "-" & " " & Me!Text73
If Not IsNull(Me!ApptNotes) Then .Body = Me!cboAssignType & Chr(13) & Chr(10) & Me!txtCoverType & Chr(13) & Chr(10) & Me!ApptNotes & Chr(13) & Chr(10) & Me!ApptInstructions & Chr(13) & Chr(10) & Me!SafetyNotes & Chr(13) & Chr(10) & Me!MaterialsRequired
If Not IsNull(Me!ApptLocation) Then .Location = _
Me!Text71 & " " & Me!ApptLocation & " " & "-" & " " & Me!Text73
.Save
End With
End If
'Release the Outlook object variable.
Set outobj = Nothing
'Set the AddedToOutlook flag, save the record, display a message.
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Exit Sub
AddAppt_Err:
MsgBox "Error" & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Go to the top of the page
 
MadPiet
post Jul 12 2017, 12:55 AM
Post#2



Posts: 2,184
Joined: 27-February 09



Karen,

Did you make sure the new Outlook library was checked in the References (Outlook 16.0)? Your code is using early binding, so if you don't explicitly add a reference to the proper library, anything that calls it will fail (because the code can't find it). If you want to hurt your brain, you can read this article: https://support.microsoft.com/en-us/help/24...g-in-automation

If someone basically changed a bunch of software on your computer or reimaged it with new software (so the old library references are missing), then it would definitely cause something like this. If you open a code module, and then go to Tools, then References, are any marked MISSING? If so, that's your problem. If it shows Outlook 14.0 is missing and Outlook 16.0 is available, you could try checking the box for 16.0 and then recompiling your code. I think it should fix it, but there are folks here with a lot more experience with using different Office libraries here than I have.

Hope this gets you pointed in the right direction,
Pieter
Go to the top of the page
 
ScottGem
post Jul 12 2017, 06:55 AM
Post#3


UtterAccess VIP / UA Clown
Posts: 32,164
Joined: 21-January 04
From: LI, NY


karen, each version of Office uses its own libraries. So while the 14 libraries were proper for Office 2010, for office 2016 you need the 16 libraries. Office apps will normally automatically update the selected references according to the version of Office installed. So if you are running Office 2016, then you should be using the 16 libraries.

--------------------
Scott <>
Scottgem's Blog
Microsoft Access MVP since 2007
Author: Microsoft Office Access 2007 VBA
Go to the top of the page
 
karenedmonds
post Jul 12 2017, 07:54 PM
Post#4



Posts: 351
Joined: 2-August 11
From: Melbourne, Australia


Firstly, let me say you guys are fabulous - never ceases to amaze me how forthcoming you are with great advice - thanks!

I have checked the references and have attached screenshot - it does seem to be pointing to 16.0 (and nothing marked missing).

When the sequence is run from the user's desktop, she gets the error message "can't find project in library" and then appears to highlight the first instance of Chr(13).

When I run from my PC, I get:
2147418113 Automation Error: Catastrophic Failure.
The debug highlights: Set outobj = CreateObject("outlook.application")

Tricky one! If you have any ideas .... smile.gif
Attached File(s)
Attached File  ACCESS_ERROR_RE_OUTLOOK.pdf ( 179.82K )Number of downloads: 0
 
Go to the top of the page
 
DanielPineault
post Jul 12 2017, 08:39 PM
Post#5


UtterAccess VIP
Posts: 5,281
Joined: 30-June 11



What about switching over to late binding and getting rid of the references altogether? Feel free to inspire, or use, the sample code found at http://www.devhut.net/2017/01/15/VBA-add-a...tlook-calendar/

Also, I'd urge you to modify your posting with your code and remove, switch the e-mail address specified to avoid it being harvested and you getting useless SPAM because of it.

Ignoring Access for a moment, does your outlook work properly?

As a test, what happens if you open Outlook manually and then try the same code but switching the CreateObject to GetObject?

Lastly, in certain cases (never figured out the pattern) CreateObject("Outlook.Application") fails and I came up with the following work around, perhaps you could give it a try, refer to: http://www.devhut.net/2014/10/31/createobj...-work-now-what/

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 
karenedmonds
post Jul 13 2017, 05:59 PM
Post#6



Posts: 351
Joined: 2-August 11
From: Melbourne, Australia


Thanks so much Daniel.

I'm afraid this may be a little over my head, but I did try your suggestion to use GetObject instead of CreateObject, to no avail.

It's very frustrating because I can see nothing obvious as to why it is no longer working, but know it is probably an easy fix (if I could identify it)!

I am almost certain it has something to do with the reference library for Office 14 - and maybe in the overhaul of our server somehow the redirected drives have lost these files or something.

I will give it a day or two in case a solution magically appears, otherwise I will have to rewrite the code, using your example (many thanks).

Cheers - have a great day! smile.gif
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    21st October 2017 - 11:43 PM