Hello everyone, I am not a pro, so I am coming to the gurus because I desperately need your help using a combination of spin button and Do loop. I am using Do Loop because I do not have a set number.
I created a spin button to allow users to enter the number of specific paragraphs to add to the document. The spin button works fine, problem is getting the info from the document based on the number selected from the spin button. Example,
Question - How many HOA paragraphs do you need?
Answer - User selects 4 with the spin button.
The merge must now insert the paragraph from another document called HOASSOCiation.doc four times. Here is what I tried but did not work.
Private Sub UserForm_Initialize()
With Spnhoa
.Min = 1
.Max = 20
.Value = 1
' Initialize TextBox
Tbhoa.Text = .Value
End With
End Sub
Then, I need the following to happen
Private Sub HOA ()
Dim number As Long
Dim min As Long
Dim max As Long
min = 1
max = 20
Do
number = Tbcondog
Loop Until number: >= min And number <= max
Selection.GoTo What:=wdGoToBookmark, Name:="HOASSOCIATION"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = True
End With
ChangeFileOpenDirectory "C:\HOA\MERGES\"
Selection.InsertFile FileName:= _
"C:\HOA\MERGES\Association.doc" _
, Range:="", ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.WholeStory
End Sub
Further
The paragraph reads:
MERGEFIELD Defendant_1 has access to the property........
Each time the paragraph is inserted, the mergefield Defendant_1 also changes.
If user selects 4, then
the first paragraph will merge with Mergefield Defendant_1,
the second paragraph will merge with mergefield Defendant_2,
the third paragraph will merge with mergefield Defendant_3 and
the fourth paragraph will merge with mergefield Defendant_4.
How do I make all this happen? I tried {SEQ Defendant_\*NUMERIC\*MERGEFORMAT} but that did not work.
Help