UtterAccess.com
We have detected that you are using an unsupported web browser. We recommend you to upgrade your web browser to get the most from UtterAccess forums.
Why should and how can I upgrade?
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Missing MSoutl.Olb    
 
   
sithlord2008
post May 8 2009, 08:07 AM
Post #1

UtterAccess Addict
Posts: 198



Hi all,
I have written a code to send an email that works fine on my system (I have the whole 0ffice 2007) but when I package it to a runtime version and test it on a user pc, it comes up:
Missing or broken reference to MSoutl.olb, but this isn't an option the reference library...
By the way all my users have either 2000 or 2003...
How can I fix this
Thanks
Lee
Go to the top of the page
 
+
Doug Steele
post May 8 2009, 09:23 AM
Post #2

UtterAccess VIP
Posts: 18,604
From: St. Catharines, ON (Canada)



Sounds as though you're using Early Binding. That's usually a problem when you're dealing with individuals with different versions of products, so you might consider using Late Binding, so that you don't need to set a reference.
ony Toews has an introduction to the topic at Late Binding in Microsoft Access
Go to the top of the page
 
+
sithlord2008
post May 8 2009, 10:20 AM
Post #3

UtterAccess Addict
Posts: 198



Hi Doug,
I have read the article and have to admit that I do not fully understand what I need to do.
How do I amend this code to relect the outlook versions and then how do I call up this code to ensure on load it is working?
Sorry to be a pain, I am a novice to this and would appreciate the help...
Thanks
Lee
Go to the top of the page
 
+
Doug Steele
post May 8 2009, 03:17 PM
Post #4

UtterAccess VIP
Posts: 18,604
From: St. Catharines, ON (Canada)



In a nutshell:
. Change any declaration statements along the line of Dim objOutlook As Outlook.Application to Dim objOutlook As Object
2. Change how you instantiate the object from Set objOutlook = New Outlook.Application to Set objOutlook = CreateObject("Outlook.Application")
3. Provide values for all intrinsic Outlook constants (they should all start ol). For example, assuming you've got something like objOutlookRecip.Type = olTo, you either need to use to use objOutlookRecip.Type = 1 or (somewhat better, since it provides some self-documentation) declare Const olTo As Long = 1
4. Remove the reference to Outlook from your application.
Step 3 is the most time consuming (finding all of the variables you're using)
Go to the top of the page
 
+
sithlord2008
post May 10 2009, 06:26 AM
Post #5

UtterAccess Addict
Posts: 198



Hi Doug,
This is what I have so far, and it doesn't want to work on me. It says user defined type not identified on the line
Dim objOutlookMsg As Outlook.MailItem
THere is my code, any pointers on where I have gone wrong:
Public Function sendInitialEmail()
On Error Resume Next
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb()
Set rs = db.OpenRecordset("QryInitialEmailDetails")
'To loop until the end would be this:
Do Until rs.EOF
Dim objOutlook As Object
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(DLookup("[Email]", "QryInitialEmailDetails"))
objOutlookRecip.Type = olTo
objOutlookMsg.SentOnBehalfOfName = (DLookup("[Emailaddress]", "QryInitialEmailDetails"))

.Subject = (DLookup("[EmailSubject]", "QryInitialEmailDetails"))
.Body = "Dear " & (DLookup("[Title]", "QryInitialEmailDetails")) & " " & (DLookup("[MainClientFirstName]", "QryInitialEmailDetails")) & " " & (DLookup("[MainClientLastName]", "QryInitialEmailDetails")) & vbNewLine & vbNewLine & (DLookup("[IntoToEmail]", "QryInitialEmailDetails")) & vbNewLine & vbNewLine & (DLookup("[InitialEmailLine1]", "QryInitialEmailDetails")) & vbNewLine & vbNewLine & (DLookup("[EmailDetails]", "QryInitialEmailDetails")) & vbNewLine & vbNewLine & (DLookup("[Emailsigbody]", "QryInitialEmailDetails")) & vbNewLine & (DLookup("[CompanyName]", "QryInitialEmailDetails")) & vbNewLine & (DLookup("[Telephone]", "QryInitialEmailDetails")) & vbNewLine & "Mailto:" & (DLookup("[EmailAddress]", "QryInitialEmailDetails")) & vbNewLine & "http://" & (DLookup("[WebSite]", "QryInitialEmailDetails"))
.Send
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End With

DoCmd.SetWarnings False
DoCmd.OpenQuery ("QryAppendInitialEmailRecord")
DoCmd.OpenQuery ("QryAppendNextemailChase")
DoCmd.SetWarnings True
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing


End Function
Thanks
Lee
Go to the top of the page
 
+
Doug Steele
post May 10 2009, 06:46 AM
Post #6

UtterAccess VIP
Posts: 18,604
From: St. Catharines, ON (Canada)



You missed step 1 (changing the declarations to As Object)
You also missed step 3 (providing values for the intrinsic Outlook constants, which in your code would be olMailItem and olTo)
Since you're not getting an error, I'd have to guess you also missed step 4 (removing the reference to Outlook)
Before you do remove the reference, go to the Immediate Window (Ctrl-G) and find the values of those two constants. You can do this by typing
?olMailItem
then hitting Enter. The value of the constant will appear on the next line. Then, type
?olTo
and hit Enter to get the value of the second constant. As I indicated in step 3, you'd then add
CODE
Const olMailItem As Long = n
Const olTo As Long = 1

to your code (sorry, I didn't look up the value of olMailItem, so you'll have to replace n with the actual value)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 20th November 2014 - 11:15 PM