Results 1 to 2 of 2

Thread: Batch print Word docms

  1. #1
    VBAX Newbie
    Apr 2023

    Batch print Word docms

    I am having issues with some Word docms. Ultimate goal is to be able to “batch” pdf multiple files from file explorer. Our Word docms utilize track changes and have includetext fields in the headers and footers. The macros I have added to the files do the following; at open, update all fields, turn off all markups, and at close, turn off track changes. See the VBA\macros below.

    Sub AutoOpen()
    'Sets the revisions view to 'Final' when opening a document
    With ActiveWindow.View.RevisionsFilter
        .Markup = wdRevisionsMarkupNone
        .View = wdRevisionsViewFinal
    End With
    Dim xRange As Range
    Dim xFiled As Field
    For Each xRange In ActiveDocument.StoryRanges
        For Each xFiled In xRange.Fields
    End Sub
    Private Sub Document_Close()
    ActiveDocument.TrackRevisions = False
    End Sub
    Macros are partly mine and other parts were harvested from other online sources. I am not not an expert, but more of a dabbler in VBA and macros.

    Macros are enabled in settings. File location was added to trusted locations. Microsoft® Word for Microsoft 365 MSO (Version 2304 Build 16.0.16327.20200) 64-bit

    The current status is when I select a group of docm files in File Explorer (Windows 11) and click on print, the files open one by one, ask for a destination for the pdf, then a dialog pops up as follows:

    "MS Visual Basic for Applications – Can’t execute code in Design Mode.”

    If I click on Ok, the pdf’s are created for each file without markups as desired. I end up with the output I am looking for, but it would be better to have one less click in the process.

    When opening the files individually, the macros work fine with no issues.

    I have tried Bluebeam Revu batch print from the add-in in Word, but the macros don’t seem to run and the pdfs are created with the markups shown, which is not what I want.

    Thanks in advance for any help or suggestions.
    Last edited by Aussiebear; 04-28-2023 at 09:22 PM. Reason: Added code tag to supplied code

  2. #2
    Try The convert to PDF option should do the job.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts