Results 1 to 3 of 3
  1. #1
    Join Date
    May 2013
    Posts
    2

    Unanswered: Ref MSOUTL.OLB breaking due to different installations, Need reference prefix?

    Developing a front end in Access 2010 (running as an MDB not an ACCDB file). Backend is SQL Server 2012 (there are zero problems with data communication at this juncture). I have Office 2010 with Windows 7 on my development computer. Users have different versions of Office (though I think they all have Windows 7) with different locations for the MSOUTL.OLB file on their computers (I need this reference so that I can have the front end send emails through Outlook). Some folks are running Office 2007, some 2010, some 2013. The MDB file resides on a network drive that all users have access to.

    I thought I'd found a work around for the problem by moving the MSOUTL.OLB file into the same folder as the MDB file then putting in code that sets the reference to that file when the MDB file gets opened up. This is the code I'm using to create the reference on start up (using an Autoexec macro to call the function):
    Code:
    Function CreateOutlookReference() As Boolean
      Dim ref As Reference
          
             On Error GoTo Error_CreateOutlookReference
             References.AddFromFile ("Y:\FPR_Parks\ParkTemps\MSOUTL.OLB")
             CreateOutlookReference = True
          
    Exit_CreateOutlookReference:
             Exit Function
       
    Error_CreateOutlookReference:
             CreateOutlookReference = False
             Resume Exit_CreateOutlookReference
       End Function
    This doesn't appear to be working because when someone who has the MSOUTL.OLB file located somewhere else on their computer opens up the MDB file, it breaks the reference. When I go into Visual Basic | Tools | References, it shows a missing reference. I remove the reference. Compile (compile doesn't go because of missing reference). Run the Autoexec macro manually. Compile, and everything's fine. The reference is there and it all works. Until the next time someone with a different installation/version opens up the MDB file.

    I have no control over the Office/Windows versions or installations or file locations and no real control over putting stuff on the C drives of the users.

    I have read that it can help if you disambiguate by putting a prefix on the objects/functions being called such as adding VBA.* or Access.Application.* but I can't figure out what the correct prefix for referencing the MSOUTL.OLB library would be. Or even if that's the right way to go. For completeness, this is the one sets of code I'm using to send out emails through Outlook:
    Code:
    Private Sub cmdNewHireEmail_Click()
    On Error GoTo Err_cmdNewHireEmail_Click
    
    'This required that I add the Microsoft Outlook 14.0 Object Library via Tools | References.
    'It should be at the top of the list, if it is not, there may be errors.
    
        Dim appOutLook As Outlook.Application
        Dim MailOutLook As Outlook.MailItem
        Dim StartDate As String
        Dim EndDate As String
        Dim PayRate As String
        Dim JobStep As String
        Dim JobTitle As String
        Dim JobLocation As String
        Dim JobHours As String
        Dim JobRegionName As String
        Dim JobRegionNumber As String
        Dim JobRegionManager As String
        Dim EmailBody As String
        Dim ReturnDate As String
        Dim PersonName As String
        
        StartDate = CStr(Forms![frmJobDetail]![StartDate])
        EndDate = CStr(Forms![frmJobDetail]![ExpectedTerminationDate])
        PayRate = CStr(Forms![frmJobDetail]![JobPayRate])
        JobStep = CStr(Forms![frmJobDetail]![JobStep])
        JobTitle = Forms![frmJobDetail]![JobTitle]
        JobLocation = Forms![frmJobDetail]![JobLocation]
        JobHours = CStr(Forms!frmJobDetail![JobHoursPerWeek])
        JobRegionName = DLookup("regionname", "qryMatchParkToRegion")
        JobRegionNumber = CStr(DLookup("region", "qryMatchParkToRegion"))
        JobRegionManager = DLookup("regionmanager", "qryMatchParkToRegion")
        ReturnDate = CStr(DateAdd("d", 10, Date))
        PersonName = DLookup("LastName", "qryGetJobWithPerson") + ", " + DLookup("FirstName", "qryGetJobWithPerson")
        
        
        Set appOutLook = CreateObject("Outlook.Application")
        Set MailOutLook = appOutLook.CreateItem(olMailItem)
        
        EmailBody = "Welcome to Vermont State Parks! blah blah blah"
        
        With MailOutLook
            .BodyFormat = olFormatHTML
            .To = DLookup("contactemail", "qryJobPersonContact")
            ''.cc = ""
            ''.bcc = ""
            .Subject = PersonName + ": Seasonal Parks Position Reservation"
            .HTMLBody = EmailBody & .HTMLBody
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\BlankHiredStaffInformationSheet.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\EmployeeInformationSheet.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\BackgroundCheckMemo.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\DeclarationofHealthCareCatamount.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\DHRStatementEmploymentConditionsTemps.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\EmployeeFingerprintAuth.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\I-9EmploymentEligibilityVerification.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\NCPA_Release_FBI.pdf")
            
            If Me.TrainingAttendance.Value = "Three Days" Then
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\SeasonalEmployeeOrientationPacketTHREEDAY.pdf")
            ElseIf Me.TrainingAttendance.Value = "One Day" Then
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\SeasonalEmployeeOrientationPacketONEDAY.pdf")
            ElseIf Me.TrainingAttendance.Value = "No Days" Then
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\SeasonalEmployeeOrientationPacketNoTraining.pdf")
            End If
           
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\TaxComplianceFormUpdated.pdf")
            .Attachments.Add ("Y:\FPR_Parks\ParkTemps\Documents\VermontW-4.pdf")
            .Display
            '.Send
        End With
    Exit_cmdNewHireEmail_Click:
        Exit Sub
    
    Err_cmdNewHireEmail_Click:
        MsgBox Err.Description
        Resume Exit_cmdNewHireEmail_Click
        
    End Sub

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    For each person that doesnt work,
    in the VBE menu, TOOLS, REFERNCES,
    have them uncheck the bad 'MISSING' outlook object lib, and checkmark their current version.

    this should solve it.

  3. #3
    Join Date
    May 2013
    Posts
    2

    unchecking missing doesn't help

    Quote Originally Posted by ranman256 View Post
    For each person that doesnt work,
    in the VBE menu, TOOLS, REFERNCES,
    have them uncheck the bad 'MISSING' outlook object lib, and checkmark their current version.

    this should solve it.
    No, it doesn't. I have been doing that and it keeps rebreaking. They do not have individual copies of the database on their computers, this is a networked copy, and unchecking the missing reference only works until the next time.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •