P
Patrickw
This refers to an earlier post entitled "Turning document text into a
label for my userform"
I have a letter in Word which is created from a merge. I want to be
able to add additional info from a userform. I would like the
userform to display information from the document in a label on the
userform; namely, one name (eg, "John Doe") or two names separated by
'and' (eg, "John Doe and Jane Doe")
I believe the easiest steps to accomplish this are as follows:
1. Create a special table in the document containing just the names of
the debtors when the document is created (from a merge)
2. Read the names from the table with a macro
3. Assign the names to a label on the userform
4. Delete the table from the document with the same macro.
This would certainly be easier than trying to parse the complex data
in another table. I already know how to read the data from such a
table (with help I received from an earlier thread) using the
following code:
' Read the client name(s) from a table in the document
strClientName = Left(ActiveDocument.Tables(1).Cell(1, 1). Range.Text,
_
Len(ActiveDocument.Tables(1).Cell(1, 1).Range.Text) - 2)
' The '-2' at the end strips two residual characters from the end
of _
the text as copied from the cell
' Convert strClientName to Title Case
strClientName = StrConv(strClientName, vbProperCase)
' If there are two clients, convert 'And' to lower case 'and'
If InStr(1, strClientName, "And", 0) > 0 Then
strClientName = Mid(strClientName, 1, InStr(1, strClientName, _
"And", 0) - 1) & LCase("And") & Mid(strClientName, InStr(1, _
strClientName, "And", 0) + Len("And"), 1000000)
End If
So how can I delete the same table from the document?
label for my userform"
I have a letter in Word which is created from a merge. I want to be
able to add additional info from a userform. I would like the
userform to display information from the document in a label on the
userform; namely, one name (eg, "John Doe") or two names separated by
'and' (eg, "John Doe and Jane Doe")
I believe the easiest steps to accomplish this are as follows:
1. Create a special table in the document containing just the names of
the debtors when the document is created (from a merge)
2. Read the names from the table with a macro
3. Assign the names to a label on the userform
4. Delete the table from the document with the same macro.
This would certainly be easier than trying to parse the complex data
in another table. I already know how to read the data from such a
table (with help I received from an earlier thread) using the
following code:
' Read the client name(s) from a table in the document
strClientName = Left(ActiveDocument.Tables(1).Cell(1, 1). Range.Text,
_
Len(ActiveDocument.Tables(1).Cell(1, 1).Range.Text) - 2)
' The '-2' at the end strips two residual characters from the end
of _
the text as copied from the cell
' Convert strClientName to Title Case
strClientName = StrConv(strClientName, vbProperCase)
' If there are two clients, convert 'And' to lower case 'and'
If InStr(1, strClientName, "And", 0) > 0 Then
strClientName = Mid(strClientName, 1, InStr(1, strClientName, _
"And", 0) - 1) & LCase("And") & Mid(strClientName, InStr(1, _
strClientName, "And", 0) + Len("And"), 1000000)
End If
So how can I delete the same table from the document?