Excel VBA error

Sub TestPdf()
    ActiveWorkbook.Sheets("Scorecard").Activate
   
   
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="\\pmcfs\groups\Accounting\Physician Stats\PhysRpts\Testsc"
       
       
       
End Sub

the above sub routine is giving me the error in Excel 2007:

Invalid Procedure Call or Argument

How can I fix this?

Thanks

Glen
GPSPOWAsked:
Who is Participating?
 
MacroShadowConnect With a Mentor Commented:
You can use the code you posted in 2007 after you install the SaveAsPDF addin from Microsoft.
0
 
KimputerCommented:
Export to PDF was introduced in Office 2010. I'm afraid you're using VBA code you picked up meant for Office 2010+.
0
 
GPSPOWAuthor Commented:
With all the different version out there now.  Is there a backwards compatability fix to save an Excel sheet as a PDF if the user is using Excel 2003 or 2007?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
KimputerCommented:
No, a function will not magically appear in older programs. If this magic happened, no person would ever buy new programs either.

Now you're backup solution might be to check if the version is 2007 or older, then check if PDF creator is installed, then use alternate code to generate it.
0
 
GPSPOWAuthor Commented:
I've requested that this question be deleted for the following reason:

Since there is not backwards compatibility between Excel 2010 and v. 2003 & 2007 to create a PDF without external programming, I am dropping the question and will try to figure out another way to do what I need.

Thanks

Glen
0
 
GPSPOWAuthor Commented:
Ill try it.

Thanks

Glen
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.