Solved

Excel VBA error

Posted on 2014-04-26
6
306 Views
Last Modified: 2014-04-26
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
0
Comment
Question by:GPSPOW
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Kimputer
Comment Utility
Export to PDF was introduced in Office 2010. I'm afraid you're using VBA code you picked up meant for Office 2010+.
0
 

Author Comment

by:GPSPOW
Comment Utility
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
 
LVL 35

Expert Comment

by:Kimputer
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:GPSPOW
Comment Utility
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
 
LVL 26

Accepted Solution

by:
MacroShadow earned 500 total points
Comment Utility
You can use the code you posted in 2007 after you install the SaveAsPDF addin from Microsoft.
0
 

Author Closing Comment

by:GPSPOW
Comment Utility
Ill try it.

Thanks

Glen
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now