Crikriek
12-19-2016, 05:31 AM
Hi,
My macro creates a word doc from an excel sheet. Once the word doc is done, I'd like to create a copy .pdf
Is there any way I could do so without saving the docs anywhere ?
Thanks !
Christophe
gmayor
12-19-2016, 05:57 AM
Are you working from Excel VBA or Word VBA? Either way the following should save the document (oDoc) as PDF, with the name and path indicated, without saving it as a Word document.
Function SaveAsPDF(oDoc As Object)
Dim strDocName As String
Dim strPath As String
strDocName = "Document Name.pdf" 'The name of the pdf
strPath = "C:\Path\" 'the path to save the document
oDoc.ExportAsFixedFormat OutputFilename:=strPath & strDocName, _
ExportFormat:=17, _
OpenAfterExport:=False, _
OptimizeFor:=0, _
Range:=0, From:=1, To:=1, _
Item:=0, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=1, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
lbl_Exit:
Exit Function
End Function
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.