Im creating an invoice Word Template on basis of Words Mail Merge. I get the necessary information via .csv file from a web application and create a table based on these informations. The data is given this way:
Person1 - InvoicePos1 - InvoicePos2 - InvoicePos3 - InvoicePos4
Person2 - InvoicePos1 - InvoicePos2 - InvoicePos3 - InvoicePos4
Person3 - InvoicePos1 - InvoicePos2 - InvoicePos3 - InvoicePos4
.
.
.
.
There are different amounts of invoice types/ invoice positions so i have to create a dynamic table which works great so far.
My problem: Word seems to automatically inserts a paragraph before each table that gets insert via a {IF}-Statement. Why do i know that its Word that inserts these paragraphs? Well the whole document is in Calibri size 12 but these Paragraphs are Times New Roman 10.
IMGUR-Link with (hopefully helpful images)
My question: Is there a way to create a macro that runs over the created document that disables/ hides each paragraph that is Times New Roman?
Ive tried different settings already to try to prevent the creation of these paragraphs but to no avail. So now im trying to hide these paragraphs after the document is created.
Sub HidePara()
If /FoundParagraphs/.Font.Name = "Times New Roman" Then
/FoundParagraphs/.Hidden = true
End If
End Sub
I know how to change the Hidden Attribute (which isnt hard at all .. ) But how would i look for either all paragraph marks (i would have to use the If-statement ive given) or (which would be better imho) filter for all paragraphs of the .Font.Name "Times New Roman". I cant find any way to find the paragraph marks at all. But than again im pretty new to VBA and actually have no idea what im doing here. As VBA is really great. facepalm