Hello all,
Have a macro that I use to fill out a form in Word. The problem is that i have a select statement in the code that if a certain cell has certain words it will fill out a textbox. My issue is that if the word "Cash" appears in that cell then a sentence containing the particular named textbox needs to be deleted. Here is the select statement that i'm using. I don't know how to make it work so it deletes the sentence in quesiton.
The .Range.Sentence.Range.Delete is the issue. i modified it from another line that had .Range.Paragraphs(1).Range.Delete.
Have a macro that I use to fill out a form in Word. The problem is that i have a select statement in the code that if a certain cell has certain words it will fill out a textbox. My issue is that if the word "Cash" appears in that cell then a sentence containing the particular named textbox needs to be deleted. Here is the select statement that i'm using. I don't know how to make it work so it deletes the sentence in quesiton.
VBA Code:
Select Case TPws.Cells(rw, "V")
Case "Bond"
Wordapp.ActiveDocument.FormFields("TXMaintID").Result = "Bond # " & TPws.Cells(rw, "X").Value 'Maintenance Bond ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID1").Result = "Bond # " & TPws.Cells(rw, "X").Value 'Maintenance Bond ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID2").Result = "Bond # " & TPws.Cells(rw, "X").Value 'Maintenance Bond ID # Entry
Case "LOC"
Wordapp.ActiveDocument.FormFields("TXMaintID").Result = "Letter of Credit (LOC) # " & TPws.Cells(rw, "X").Value 'Maintenance LOC ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID1").Result = "LOC # " & TPws.Cells(rw, "X").Value 'Maintenance LOC ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID2").Result = "LOC # " & TPws.Cells(rw, "X").Value 'Maintenance LOC ID # Entry
Case "Cash"
Wordapp.ActiveDocument.FormFields("TXMaintID").Result = "Cash Bond Per Receipt # " & TPws.Cells(rw, "BD").Value 'Maintenance LOC ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID1").Result = "Cash Bond Per Receipt # " & TPws.Cells(rw, "BD").Value 'Maintenance LOC ID # Entry
Wordapp.ActiveDocument.FormFields("TXMaintID2").Range.Sentence.Range.Delete
End Select
The .Range.Sentence.Range.Delete is the issue. i modified it from another line that had .Range.Paragraphs(1).Range.Delete.