Graphs not displaying in pdf when exporting from excel

Closed
JimmyJazz
Posts
1
Registration date
Wednesday October 19, 2016
Status
Member
Last seen
October 19, 2016
- Oct 19, 2016 at 08:45 AM
I have written a macro that selects three worksheets in my report that contain graphs, and converts them to a pdf, saving it in a particular location. Although it worked when I wrote the macro, every time I run it again, the graphs do not show. Some times, an error occurs at the activesheet section of the code as well. Here is the code:

Sub pdf()
'
' pdf Macro
'

'
    Sheets(Array("Responsible-Agency-Graphs", "Points-Prevalence-Graphs", _
        "Age-Profile-Summary")).Select
    Sheets("Responsible-Agency-Graphs").Activate
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "P:\Patient_Flow_Team\Discharge-Planning\Points-Prevalence\201617\PDFGraphs\PP-Graphs.pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=False, _
        IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub