Error with Index, ENVIRON and EXCEL.exe

dear team,
I am using office 2016.
i have developed a database using office 2016.
after deploying my end users (uses office 2013 ) facing issues with application.
1. on opening database . It is popup with  " searching for referenced file EXCEL.exe ".
2. HERE IS THE CODE FOR YOUR REFERENCE.
********************************************************************************************************************************
Option Compare Database
Private Sub cmdchemicalsearchexport_Click()
 Dim saveloc As String, strWorksheetPath As String, xl As Object, wb As Object
    Dim exportsheet As Object, Header As Variant, OIHeader As Variant
    'Dim db As DAO.Database, ExportRecordSet As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Dim rs As Recordset
    saveloc = Environ("USERPROFILE") & "\Desktop\"
    saveloc = strWorksheetPath & "ChemicalSearchReport.xlsx"
    Set xl = CreateObject("Excel.Application")
    Set wb = xl.Workbooks.Add
    Set exportsheet = wb.Worksheets(1)
    exportsheet.Name = "Chemical Search"
    xl.Application.Visible = True
   Set rs = db.OpenRecordset(Me.RecordSource)
        exportsheet.Cells(1, 1).Value = "Trade Name"
        exportsheet.Cells(2, 1).Value = "Supplier"
        exportsheet.Cells(3, 1).Value = "Category"
        exportsheet.Cells(4, 1).Value = "Physical Appearance"
        exportsheet.Cells(5, 1).Value = "Active Ingredient"
        exportsheet.Cells(6, 1).Value = "Regional Availability"
        exportsheet.Cells(7, 1).Value = "EPA#"
        exportsheet.Cells(8, 1).Value = "Comment"
        exportsheet.Range("A1:A8").Font.Bold = True
    Dim rownum As Long, colnum As Long
    Dim i As Long
    i = 0
    rownum = 1
    colnum = 2
    rs.MoveFirst
    For Index = 1 To rs.Fields.Count
    If rs.Fields(i).Name <> "SDS" And rs.Fields(i).Name <> "CID" Then
        Do While Not rs.EOF
        exportsheet.Cells(rownum, colnum).Value = rs.Fields(i).Value
        rs.MoveNext
        colnum = colnum + 1
        Loop
        rownum = rownum + 1
        colnum = 2
    End If
    i = i + 1
    rs.MoveFirst
    Next
  With exportsheet
  .Cells(1, i).Select
   Set testRange = .Range(.Cells(1, 1), .Cells(i - 2, i + 1))
 End With
  testRange.Borders.LineStyle = xlContinuous
exportsheet.Cells.EntireColumn.AutoFit
    End Sub
********************************************************************************************************************************
ERROR 1 :
POINTING to Environ(saveloc = Environ("USERPROFILE") & "\Desktop\")
Compile error:
Can't find project or library
ERROR 2:
I HAVE COMMENTED i.e 'saveloc = Environ("USERPROFILE") & "\Desktop\"
pointing to  Index ( for your referecne For Index = 1 To rs.Fields.Count)
Can't find project or library
Nagender ReddyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieData ProcessorCommented:
Where are you trying to run this code?

Wherever it is what do you see when you goto Tools>References...?

Is anything marked as MISSING?

PS What happens if you add this to the declarations?
Dim Index As Long

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nagender ReddyAuthor Commented:
Working
0
MacroShadowCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Norie (https:#a42378717)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

MacroShadow
Experts-Exchange Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.