Compile Error

Manzo

New Member
Joined
Dec 15, 2015
Messages
2
Hi All,

I've been asked to test excel docs as we are changing from office 2007 to 2016.

Running the following code, I receive a Compile Error - Can't Find Project or Library.

Code:
Public Sub BatchPDF()
    Dim n As Integer, i As Integer
    Application.ScreenUpdating = False
    If Sheets("BatchList").Visible = True Then Sheets("BatchList").Visible = False Else Sheets("BatchList").Visible = True
    Sheets("BatchList").Select
    ' Find the last row of data
    FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
    ' Loop through each row
    For x = 2 To FinalRow
    ThisValue = Cells(x, 2).Value
    If ThisValue <> " " Then
    Cells(x, 1).Copy
    Sheets("Report").Select
    Range("E7").Select
    ActiveSheet.Paste
    Sheets("BatchList").Select
    End If
    Sheets(Array("Report")).Select
    Sheets("Report").Activate
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "D:\Supplier Level\Supplier Performance Report\" & Range("E6").Value, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, OpenAfterPublish:=False
    Sheets("BatchList").Select
    Next x
    Sheets("BatchList").Visible = False
    Application.ScreenUpdating = True
    End Sub

Is this a code error (previously worked fine on 2007) or an excel issue ? I am running this via remote desktop, could this cause an issue ?

Thanks for your help
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the Board!

From a computer/system that it runs fine on, go into the VB Editor, then go to Tools -> References and note all the References that are selected.
Then, on this other computer where it is not working, do the same thing, and note if you are missing any references (should be the same number as you found on the one that works).
 
Upvote 0
Thanks Joe, there are some references missing. They all apear to be acrobat related which would make sense as I'm generating PDF's. I have requested acrobat to be installed on the office 16 machine.
Also Microsoft Object Libary changes from 12.0 to 16.0 and the Adobe Acrobat type library changes from 9.0 to 10.0.
Would this also effect it ?
 
Upvote 0
Also Microsoft Object Libary changes from 12.0 to 16.0 and the Adobe Acrobat type library changes from 9.0 to 10.0.
Would this also effect it ?
That should be fine. As long as the version is not earlier (a lower number than the original), you probably won't run into any issues.
The important thing is to get the same reference name.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,173
Latest member
Kon123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top