#1
|
|||
|
|||
Macro to save as PDF but with a different name
Hi all...
I posted a solution for a macro which saves as a pdf as below: Sub Word2PDF() ' ' Word2PDF Macro ' ' ActiveDocument.ExportAsFixedFormat OutputFileName:= _ ActiveDocument.Path & "\" & ActiveDocument.Name & ".pdf", ExportFormat:= _ wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _ wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=True, UseISO19005_1:=False End Sub But I would like to be able to save with a different file name - can anyone suggest how I do this? Basically if I have a word doc named temp.docx it creates a pdf with the name temp.docx.pdf and I would like to remove the .docx extension. Thanks! |
#2
|
||||
|
||||
Hi shabbaranks,
Try: Code:
Sub Word2PDF() With ActiveDocument .ExportAsFixedFormat OutputFileName:=Split(.FullName, ".")(0) & ".pdf", _ ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _ OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=True, UseISO19005_1:=False End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Worked like a charm - thanks!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PowerPoint Crashes every time I try to save/save as | Crimson_Ninja | PowerPoint | 0 | 05-04-2011 01:54 PM |
Macro to Save Help | clarkson001 | Word | 0 | 02-14-2011 06:41 AM |
Word Macro: Save file as text with current file name | jabberwocky12 | Word VBA | 2 | 10-22-2010 12:23 PM |
Macro will not save to normal.dot file when exiting | bobbraun | Word | 1 | 09-28-2010 06:26 AM |
Macro Won't Save | lou0915 | Word VBA | 2 | 10-17-2009 08:13 PM |