Excel to PDF

johnbird1988

Board Regular
Joined
Oct 6, 2009
Messages
198
Hello

I have the below bit of code, it works fine on my PC but on a collogues PC it errors at the "ActiveSheet.ExportAsFixedFormat...." Does anyone know why this happened. The message we also get is: "invalid procedure call or argument"

Thank you

John</SPAN>

Sub Make_Individualreport()
Dim pdfName As String
Dim spath As String
Dim KPIDATE As String
Dim stlist As Range

'Define where the list of names are
Set stlist = Worksheets("Manual Data").Range("R1:R10")
'Now we loop through the list
For Each c In stlist
'Set the cell value
Worksheets("Manual Data").Range("C7") = c.Value
'print it!
pdfName = Worksheets("Manual Data").Range("C7").Text
spath = "JDrive\Team\KPI Report\TEST\"
KPIDATE = Worksheets("Manual Data").Range("C3").Text

fname = spath & "PROTECT - COMMERCIAL " & pdfName & " KPI " & KPIDATE & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fname, Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, OpenAfterPublish:=False
'MsgBox ("Files saved in your drive")
Next c
End Sub
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,325
Members
414,053
Latest member
Dual Showman

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
Top