How do I save a specified single sheet as a PDF or DXF from a macro?

I am creating a batch macro that will create a PDF and a DXFand tell me in Excel how many sheet are in a drawing for whateverdrawings I specify. However, I only want a DXF of the last sheet.

I know the command to return how many sheet there are. How do Ispecify that I want to save the last sheet as a DXF?

Also, is there anyway to save only a single sheet to PDF?

Thanks for your help,

BevanSolidworksApi macros