I have a request form that has been used by two departments for the past two years. After we went through an upgrade from Office 2007 to Office 2010, Department A is still able to use the form, while Department B receives the message "Compile Error: Can't find project or library". I have attached to this post a copy of the form, and a screenshot of the error being received by Department B. The form itself is much more complicated, but this is a simplified version that saves the PDF to your desktop so that it can be tested by anyone. If I can fix the error on this one, I should be able to incorporate the solution into the more complicated version.
Thanks in advance for any help that comes my way!
Screenshot of the Compile Error >>> Compile Error.jpg
Sub sendpdf01()
Dim FileName As String
Dim UserDesktop As String
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
UserDesktop = WshShell.SpecialFolders(4) & "\"
FileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
UserDesktop & Cells(2, 2).Value & " - " & Cells(6, 2).Value & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Range("A1:D28").Select
MsgBox "This request has been saved to your desktop."
End Sub
Bookmarks