Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2018, 05:25 AM
Filipe Filipe is offline Macro to create sequencial versions from a word doc to sequencial pdf files. Windows 10 Macro to create sequencial versions from a word doc to sequencial pdf files. Office 2013
Novice
Macro to create sequencial versions from a word doc to sequencial pdf files.
 
Join Date: Dec 2018
Posts: 1
Filipe is on a distinguished road
Default Macro to create sequencial versions from a word doc to sequencial pdf files.

Hi all,
My name is Filipe and I´m a new member on this forum.
Following the guidelines for creating macros in a word document, I was able to create a macro that registers the changes made to a pdf document:

Code:
Sub A2()
'
' A2 Macro
' Record PDF (Utente MFJ)
'
    ActiveDocument.ExportAsFixedFormat OutputFileName:= _
        "\\servidor\qsspublic\enfermagem\PISO A\A2 - MFJ\Diario Clinico\Registos\PDFs 2018\Rec 01.12.2018 .pdf" _
        , ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
        wdExportOptimizeForOnScreen, Range:=wdExportAllDocument, From:=1, To:=1, _
        Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
        CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
        BitmapMissingFonts:=True, UseISO19005_1:=False
    ChangeFileOpenDirectory _
        "\\servidor\qsspublic\enfermagem\PISO A\A2 - MFJ\Diario Clinico\Registos\PDFs 2018\"
End Sub
But it doesn’t preserve the first copy and always replaces the existing one with the new one (Rec 01.12.2018.pdf). Will it be possible to insert a command in this macro that allows the creation of pdf files in a sequential way (such as Rec 03.12.2018.pdf ..... Rec 04.12.2108.pdf ... etc.) or similar, but without replacing the previous record? (I only make one change per day).


What code should I add or change in my example to get this result?
Very grateful for the help, I have tried to find a solution on the web, but without success.

Best regards,
Filipe
Reply With Quote
  #2  
Old 12-03-2018, 02:32 PM
macropod's Avatar
macropod macropod is offline Macro to create sequencial versions from a word doc to sequencial pdf files. Windows 7 64bit Macro to create sequencial versions from a word doc to sequencial pdf files. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub A2()
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
  "\\servidor\qsspublic\enfermagem\PISO A\A2 - MFJ\Diario Clinico\Registos\PDFs 2018\Rec" & _
  Format(Now, "DD.MM.YYYY") & ".pdf", _
  ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, _
  OptimizeFor:=wdExportOptimizeForOnScreen, Range:=wdExportAllDocument, _
  From:=1, To:=1, Item:=wdExportDocumentContent, IncludeDocProps:=True, _
  KeepIRM:=True, CreateBookmarks:=wdExportCreateNoBookmarks, _
  DocStructureTags:=True, BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub
or, if it's only a one-page document:
Code:
Sub A2()
ActiveDocument.SaveAs2 FileName:= _
  "\\servidor\qsspublic\enfermagem\PISO A\A2 - MFJ\Diario Clinico\Registos\PDFs 2018\Rec" & _
  Format(Now, "DD.MM.YYYY") & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
word doc to pdf



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to create sequencial versions from a word doc to sequencial pdf files. Batch create word files with link to changing excel hannes.ledegen Mail Merge 8 04-07-2016 01:22 AM
How to create a MS word file that automatically logs something specific inside other WORD files? meys Word VBA 1 01-04-2015 05:22 AM
Macro to create sequencial versions from a word doc to sequencial pdf files. Global macro across a number of different word files daffy Word VBA 6 07-08-2014 05:42 PM
sequencial numbering keeps breaking tpen3219 Word 4 12-05-2012 07:45 PM
Merging word files from excel macro hklein Excel Programming 0 08-05-2011 02:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft