Hello,
I am building an invoice generator that fills in a word template based on values in an Excel table. It all works fine - except for the address, which contains these rectangle-shaped special characters in all address lines
but the first one:
The corresponding cell value in the Excel table is:
The address in the Word template is located in a table cell. Reading out the contents of the cell
returns the following result in the Immediate window:
The VBA code is as follows:
What can I do to remove these special characters? Does anyone know if this character has a Char code that I can use to remove it?
BTW: If I just straight copy the value from to the Excel cell to the Word document, the formatting is just fine:
I am building an invoice generator that fills in a word template based on values in an Excel table. It all works fine - except for the address, which contains these rectangle-shaped special characters in all address lines
but the first one:
The corresponding cell value in the Excel table is:
The address in the Word template is located in a table cell. Reading out the contents of the cell
VBA Code:
Debug.Print WordDoc.Tables(1).Cell(1, 1).Range
returns the following result in the Immediate window:
STEFES BAU GmbH
Pfalzburger Str. 85
28207 Bremen
Deutschland
The VBA code is as follows:
VBA Code:
With WordDoc.Content.Find
.Text = "[" & ContainerHeader(LBound(ContainerHeader), h) & "]"
.Replacement.Text = Format(Replace(ContainerValues(i, h), Chr(10), vbNewLine), varTypes(1, h))
.Wrap = 1 '1 = wdFindContinue
.Execute Replace:=2 '2 = wdReplaceAll, '1 = wdReplaceOne
End With
What can I do to remove these special characters? Does anyone know if this character has a Char code that I can use to remove it?
BTW: If I just straight copy the value from to the Excel cell to the Word document, the formatting is just fine: