Dear team,
I need your help again: I need to fill in a form every month when I review the accounts in a particular system. This way I keep a track of who is deactivated, who didn't access the system in a long time and who is still active.
Is there a way in Alteryx to:
- turn a Word document into a PDF
- fill in the fields on the pdf document with some template-like text
- combine the pdf with the monthly user report
If I can create some sort of dynamic app to have this document ready, it would help me tremendously.
Your suggestions are greatly appreciated!
Regards,
Ioana
Alteryx cannot read Word documents. If you have the Intelligence Suit package you can read in PDF, BMP, JPEG, PNG. Another way could be developing a Python code to read DOCX.
If you save the code below as a macro in Word and run it, it will prompt you for the directory you have your documents in and will convert them to a PDF. The PDF documents are placed back in the same directory. It does about a document each second. Then you can use Alteryx to read the PDF.
Sub SaveAllAsPDF()
Dim strFilename As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim intPos As Integer
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.doc")
While Len(strFilename) <> 0
Set oDoc = Documents.Open(strPath & strFilename)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
'This instruction converts to PDF
strDocName = strDocName & ".pdf"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatPDF
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFilename = Dir$()
Wend
End Sub