Hello,

In Word 2019 I have made a template with inputfields for my colleagues. At the bottum is a commandbutton.
When finishing the inputfields, they have to push the button.

- Is scrolls up the page (nessesary for the filename)
- it shows a messagebox (for the filename)
- it will save the file as PDF

The code is:

Private Sub CommandButton1_Click()
Dim Map As String
Dim Bestandsnaam As String
ActiveWindow.SmallScroll Down:=-35

With ActiveDocument
    
    .Shapes(1).Visible = msoFalse       'To hide the button for making a pdf
    Map = "C:\RvB\"                    
    Bestandsnaam = InputBox("Idem als de mail, bijvoorbeeld:  W-postcode+nr-plaats-naam", "Bestandnaam invullen") & ".pdf"
    ActiveDocument.ExportAsFixedFormat OutputFileName:=Map & Bestandsnaam, ExportFormat:=wdExportFormatPDF, _
        OpenAfterExport:=True, OptimizeFor:=wdExportOptimizeForPrint, UseISO19005_1:=False
    .Shapes(1).Visible = msoTrue
    
End With
End Sub
Knipsel.JPG

The problem is:

When word is in editing limited (Sorry, I have a Dutch version of Word) and its protect with '2. fill in forms' (So the users can only tab to the inputfields), this code doesn't work. When the protection 'fill in forms' is not checked en I secure it, then it works. But that's not what I want.

Is is possible to get this code working?
There is no password required.

RvB_20201020_TEST.zip
Grz Robert, Netherlands