Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 811
  • Last Modified:

MS Excel Macro to print to PDF and save to a certain file name and overright it if necessary

I have included a recorded VBA macro that seems to choose PDF as my print option, but then I am asked for a file name.  Is there a way to modify what I have included to save to a file in a particular folder and replace if nesseary.  Many thanks!
Sub Print_to_PDF()
'
' Print_to_PDF Macro
'

'
    Application.ActivePrinter = "Adobe PDF on Ne06:"
    ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,""Adobe PDF on Ne06:"",,TRUE,,FALSE)"
End Sub

Open in new window

0
majervis
Asked:
majervis
1 Solution
 
jpaulinoCommented:
If you use Excel 2007 (like the tags you added shows), you can use ExportAsFixedFormat  method.

Check this example: http://www.excelguru.ca/node/92
0
 
majervisAuthor Commented:
Exactly what I was looking for.  Thank you for the fast reply.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now