cjtaylor0103
New Member
- Joined
- Apr 10, 2023
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello,
No coding experience other than what I've done here to stitch together a few people's code. I'm almost where I need to be, but have 2 problems.
First, this line of code is grabbing data from an excel spreadsheet and moving it in to a word template. When the data being moved is a currency and the currency ends in a .00 or .#0, it cut's off the zero(s) in the output file. $95.00 turns to $95 and $95.50 turns to $95.5. How might I adjust this code to bring in two decimals even if one or both are zeros?
Second, I'm hoping to save the created document as a PDFs instead of .docx. The target file for moving excel data is a Word Template (.dotx). Can I adjust the below code to output a PDF document when I run the macro?
Many thanks for the assist!
No coding experience other than what I've done here to stitch together a few people's code. I'm almost where I need to be, but have 2 problems.
First, this line of code is grabbing data from an excel spreadsheet and moving it in to a word template. When the data being moved is a currency and the currency ends in a .00 or .#0, it cut's off the zero(s) in the output file. $95.00 turns to $95 and $95.50 turns to $95.5. How might I adjust this code to bring in two decimals even if one or both are zeros?
VBA Code:
.Application.Selection.Find.Text = "<<total!>>"
.Application.Selection.Find.Execute
.Application.Selection = Sheet1.Cells(r, 13).Value
.Application.Selection.EndOf
Second, I'm hoping to save the created document as a PDFs instead of .docx. The target file for moving excel data is a Word Template (.dotx). Can I adjust the below code to output a PDF document when I run the macro?
VBA Code:
custN = Sheet1.Cells(r, 3).Value
type1 = Sheet1.Cells(r, 5).Value
path = ActiveWorkbook.path & "\OUTPUT\"
.SaveAs2 Filename:=path & custN & "_" & type1, _
FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
Many thanks for the assist!