writing macro to convert excel to pdf

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need help writing a macro to automatically save an excel file as a pdf with
the new pdf being saved as the reference of a particular cell. I currently
know how to write a macro to save an excel file as a reference to a
particular cell but need help taking it to the next step and saving it as a
PDF. Any help would be greatly appreciated.
 
Hi Matt,
Simply record a macro and change the printer to pdf
via File, Print (assuming you are set up to print PDF from Excel),
then work that generated code into your macro.
 
David,

Thanks for the help.

The code I have thus far is as follows:
ActiveWorkbook.SaveAs Filename:=Range("B11")
Application.ActivePrinter = "Adobe PDF on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne01:", Collate:=True

This saves the file as a pdf referenceing a specific cell, which is what I
want. However, when I do this, it brings up the "Save Pdf File As" screen,
where I have to hit enter or save. I can't figure out a way to bypass this.
Any suggestions?
 
Hi Matt,

Application.DisplayAlerts=False
...your code here....
Application.DisplayAlerts=True
 
I'm almost there. The command below solves the problem of eliminating the
"this file already exhists, do you want to replace" prompts. However, I
still need a way to skip over the "save pdf as" page that allows you to
override the file name and location to save. I don't think this is
considered an "alert" so it is not diabled. Any help on this would be great.
 
Back
Top