Falttening the PDF

Sub Flatten_Folder()
Dim MyFile As String
Mypath = InputBox("Enter the path to the folder where the PDF files are Located **MUST END WITH \**")
MyFile = Dir(Mypath)
Do While MyFile <> ""
If MyFile Like "*.PDF" Or MyFile Like "*.pdf" Then
Fullpath = Mypath & MyFile
Set App = CreateObject("AcroExch.app")
Set avdoc = CreateObject("AcroExch.AVDoc")
Set pdDoc = CreateObject("AcroExch.PDDoc")
Set AForm = CreateObject("AFormAut.App")
pdDoc.Open (Fullpath)
'// MsgBox ("It is " + pdDoc.IsSigned + " that this FDF is signed")
Set avdoc = pdDoc.OpenAVDoc(Fullpath)
js = "this.flattenPages();"
'//execute the js code
AForm.Fields.ExecuteThisJavaScript js

Set pdDoc = avdoc.GetPDDoc

pdDoc.Save PDSaveFull, Fullpath
Set AForm = Nothing
Set avdoc = Nothing
Set App = Nothing
End If
MyFile = Dir
End Sub