I have an Excel SS that allows the user to make selections for a configurable product and once done produce a quote. I can successfully gather the data and launch a word template that works, but now I am asked to add or delete specific rows dependent on the selection. This means identifying text in the word document and returning the row number. As an example P725-M-6W2H-6T-18A-[highlight #FCE94F]4UN[/highlight]-SL-R-T-FC24 I would need to add a row after 4UN. How would I identify the row number in the attached table.
Here's also an example of how I add or delete rows currently from fixed locations.
Can anyone help?
Here's also an example of how I add or delete rows currently from fixed locations.
Can anyone help?
Code:
'Populate Model Key Table
wordDoc.Tables(7).Cell(3, 1).Range.Text = Range("O25").Value ' Window size
wordDoc.Tables(7).Cell(6, 1).Range.Text = Range("P31").Value ' TAR column
wordDoc.Tables(7).Cell(6, 2).Range.Text = Range("O31").Value ' TAR text
wordDoc.Tables(7).Cell(8, 1).Range.Text = Range("O17").Value ' Illumination type
wordDoc.Tables(7).Cell(8, 2).Range.Text = "Illumination by pluggable" & " " & Range("C9").Value ' Illumination type Text
If Range("C10").Value = "No" Then
wordDoc.Tables(7).Rows(9).Delete
End If
If Range("C12").Value = "No" Then ' Tropicalisation
wordDoc.Tables(7).Rows(10).Delete
End If
If Range("C11").Value > 0 Then ' Unarmed channels
wordDoc.Tables(7).Rows(8).Select
wordApp.Selection.Rows.Add[img]https://res.cloudinary.com/engineering-com/image/upload/v1528918479/tips/Table_wzzewe.jpg[/img]
wordDoc.Tables(7).Cell(8, 1).Range.Text = Range("P24").Value '
wordDoc.Tables(7).Cell(8, 2).Range.Text = "Number of Unarmed Windows"
End If
If Range("C16").Value = "No" Then
wordDoc.Tables(7).Rows(14).Delete
End If