mrprex
01-03-2017, 04:16 PM
Hi! I am new here!
I am a beginner in vba and need some assistance.
On the table below, we have a content control that can repeat. on the example below see column "CRR".
We are extracting the value of the repeating CRR using the code below. It works however the result is not in order. on this case the extracted value is 2,3,1. how do we make it in order to show 1,2,3?
Sub TESTRUN()
Dim S As Integer
Dim E As Integer
Dim M As String
E = ActiveDocument.SelectContentControlsByTag("CRR").Count
For S = 1 To E
M = ActiveDocument.SelectContentControlsByTag("CRR").Item(S).Range.Text & " " + "; " + M
Next S
End Sub
#
Facility
Note #
Borrower
*
CRR
NRR
C Acc
N Acc
Interest Accrual
Term / Amo.
Approx. Mthly Pmt
Maturity
Commit.
($000’s)
Out.
($000’s)
-
Facility
Note
Borrower
^
1
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out
-
Facility
Note
Borrower
^
2
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out
-
Facility
Note
Borrower
^
3
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out
I am a beginner in vba and need some assistance.
On the table below, we have a content control that can repeat. on the example below see column "CRR".
We are extracting the value of the repeating CRR using the code below. It works however the result is not in order. on this case the extracted value is 2,3,1. how do we make it in order to show 1,2,3?
Sub TESTRUN()
Dim S As Integer
Dim E As Integer
Dim M As String
E = ActiveDocument.SelectContentControlsByTag("CRR").Count
For S = 1 To E
M = ActiveDocument.SelectContentControlsByTag("CRR").Item(S).Range.Text & " " + "; " + M
Next S
End Sub
#
Facility
Note #
Borrower
*
CRR
NRR
C Acc
N Acc
Interest Accrual
Term / Amo.
Approx. Mthly Pmt
Maturity
Commit.
($000’s)
Out.
($000’s)
-
Facility
Note
Borrower
^
1
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out
-
Facility
Note
Borrower
^
2
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out
-
Facility
Note
Borrower
^
3
-
-
-
Accrual
T/A
Pmt
Date
Commit
Out