gojets1721
Registered User.
- Local time
- Yesterday, 22:18
- Joined
- Jun 11, 2019
- Messages
- 430
So I've got the below code that works flawlessly to pull an entry from a form into a report that exports to a PDF. I'm trying to use the exact same code but to export to Microsoft Word instead (if possible). I've tried to use a few online guides but they don't mesh perfectly with my code and I'm admittedly still learning VBA. Any thoughts on what needs to be changed to export to Word rather than PDF?
Code:
Private Sub cmd_exportformPDF_Click()
Dim reportName As String
Dim criteria As String
Dim strfolder As String
Dim strfilename As String
reportName = "CompletedForm"
criteria = "[ComplaintNumber]= " & [Forms]![frm2021Details]![ComplaintNumber]
strfolder = "F:\Documents"
strfilename = Me.CustomerLastName & ", " & Me.CustomerFirstName & " " & Format(Me.DateOpened, "m.d.yyyy") & ".pdf"
DoCmd.OpenReport reportName, acViewPreview, criteria, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, strfolder & strfilename
DoCmd.Close acReport, reportName, acSaveNo
End Sub