missing or broken reference 'EXCEL.EXE' version 1.6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan H
    New Member
    • Nov 2007
    • 104

    missing or broken reference 'EXCEL.EXE' version 1.6

    I am getting this error when I install an Access 2007 db with the packaged runtime engine on a machine running Office 2003. When I look at the references on the developing PC, the Microsoft Excel Library is listed in the references.

    Any ideas how to begin to fix this problem?
  • HiTechCoach
    New Member
    • Nov 2007
    • 30

    #2
    I have found it is best to use late binding whever possible. The is especially helpful when you have to support multiple versions of Office.

    See
    Early vs Late binding

    Hope this helps ...

    Comment

    • Nathan H
      New Member
      • Nov 2007
      • 104

      #3
      Originally posted by HiTechCoach
      I have found it is best to use late binding whever possible. The is especially helpful when you have to support multiple versions of Office.

      See
      Early vs Late binding

      Hope this helps ...

      Still lost...

      Excel Object Library in the references...ch eck
      Dim appExcel As Excel.Applicati on in the code...check

      Working...nope

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Originally posted by Nathan H
        Still lost...

        Excel Object Library in the references...ch eck
        Dim appExcel As Excel.Applicati on in the code...check

        Working...nope
        Hi Nathan

        Did you ever get this one figured out ?

        I can get some of the other experts to look at it if you didn't. Unfortunately, I don't use the runtime library much so not an area I specialise in :D

        Mary

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Just a quick note after re-reading your original post. The runtime library is obviously looking for a 2007 Excel reference and not finding it. Can you change the reference in the 2007 application to a 2003 excel library reference before moving it?

          Comment

          • Nathan H
            New Member
            • Nov 2007
            • 104

            #6
            Originally posted by mmccarthy
            Just a quick note after re-reading your original post. The runtime library is obviously looking for a 2007 Excel reference and not finding it. Can you change the reference in the 2007 application to a 2003 excel library reference before moving it?
            Hi Mary,

            Still working on this problem. You gave me an idea though...I had to add a reference to Excel objects 11 in Access 2007 (it was only giving me objects 12). I will have to test this.

            Thanks,

            Nathan

            Comment

            • MMcCarthy
              Recognized Expert MVP
              • Aug 2006
              • 14387

              #7
              Originally posted by Nathan H
              Hi Mary,

              Still working on this problem. You gave me an idea though...I had to add a reference to Excel objects 11 in Access 2007 (it was only giving me objects 12). I will have to test this.

              Thanks,

              Nathan
              You're welcome, I hope it works out for you.

              Comment

              • Nathan H
                New Member
                • Nov 2007
                • 104

                #8
                Still need help with this issue. I thought I had it, but now I don't. I need this code modified to be able to work without any Excel Object Library checked in the references. I have got e-mails about early binding/late binding and all that cool stuff...but it just is not clicking for me. I need to run this on machines with Excel 2002, 2003, and 2007...

                Code:
                Private Sub cmdTEST_Click()
                On Error GoTo NORECORD
                
                Dim objExcel As Excel.Application, strExcelPath As String
                Set objExcel = New Excel.Application
                strExcelPath = objExcel.Path & "\"
                Debug.Print strExcelPath
                Set objExcel = Nothing
                Dim FullExcelPath As String
                FullExcelPath = (strExcelPath & "excel.exe")
                
                DoCmd.SetWarnings False
                DoCmd.OpenQuery "qryTEST"
                DoCmd.OutputTo acOutputTable, "tblTEST", "*.xls", "C:\Test\data\test.xls", False
                
                Call Shell(FullExcelPath & " ""C:\test\test.xls""", 1)
                txtLOC.Value = "Test Query Completed ---" & FullExcelPath
                Exit Sub
                
                NORECORD:
                MsgBox "The query returned no records.  Please reformat your search criteria.", vbOKOnly, "NB"
                
                End Sub

                Comment

                • FishVal
                  Recognized Expert Specialist
                  • Jun 2007
                  • 2656

                  #9
                  Hi, Nathan.

                  MS Office usually adds upon installation path to itself to OS PATH variable.
                  Do you ever need to invoke Excel using full path?

                  Comment

                  • ADezii
                    Recognized Expert Expert
                    • Apr 2006
                    • 8834

                    #10
                    Originally posted by Nathan H
                    Still need help with this issue. I thought I had it, but now I don't. I need this code modified to be able to work without any Excel Object Library checked in the references. I have got e-mails about early binding/late binding and all that cool stuff...but it just is not clicking for me. I need to run this on machines with Excel 2002, 2003, and 2007...

                    Code:
                    Private Sub cmdTEST_Click()
                    On Error GoTo NORECORD
                    
                    Dim objExcel As Excel.Application, strExcelPath As String
                    Set objExcel = New Excel.Application
                    strExcelPath = objExcel.Path & "\"
                    Debug.Print strExcelPath
                    Set objExcel = Nothing
                    Dim FullExcelPath As String
                    FullExcelPath = (strExcelPath & "excel.exe")
                    
                    DoCmd.SetWarnings False
                    DoCmd.OpenQuery "qryTEST"
                    DoCmd.OutputTo acOutputTable, "tblTEST", "*.xls", "C:\Test\data\test.xls", False
                    
                    Call Shell(FullExcelPath & " ""C:\test\test.xls""", 1)
                    txtLOC.Value = "Test Query Completed ---" & FullExcelPath
                    Exit Sub
                    
                    NORECORD:
                    MsgBox "The query returned no records.  Please reformat your search criteria.", vbOKOnly, "NB"
                    
                    End Sub
                    1. How abouot code similar to this in the Open() Event of your Main Form to explicitly check for an Excel Reference?
                      [CODE=vb]
                      Private Sub Form_Open(Cance l As Integer)
                      Dim ref As Reference, blnExcelIsRefer enced As Boolean, strMsg As String

                      Msg = "A Required Reference to the Excel Object Library is MISSING!"

                      For Each ref In Application.Ref erences
                      If ref.Name = "Excel" Then
                      blnExcelIsRefer enced = True
                      Else
                      blnExcelIsRefer enced = False
                      End If
                      Next

                      If Not blnExcelIsRefer enced Then
                      MsgBox Msg, vbCritical, "Missing Excel Reference"
                      'Exit Main Form but stay in Access to fix
                      Cancel = True
                      End If
                      End Sub[/CODE]
                    2. You started off with Automation code to establish the Path to Excel, why not stay with it to Open the Workbook instead of Shelling out?
                      [CODE=vb]
                      Dim objExcel As Excel.Applicati on, strExcelPath As String
                      Set objExcel = New Excel.Applicati on

                      objExcel.Visibl e = True

                      DoCmd.SetWarnin gs False
                      DoCmd.OpenQuery "qryTest"
                      DoCmd.OutputTo acOutputTable, "tblTEST", "*.xls", "C:\Test\Data\T est.xls", False
                      DoCmd.SetWarnin gs True

                      objExcel.Workbo oks.Open ("C:\Test\Data\ Test.xls")[/CODE]

                    Comment

                    Working...