![]() |
#1
|
|||
|
|||
![]()
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 ![]() ![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
maximus123 | PowerPoint | 1 | 08-04-2015 05:33 AM |
How to copy format of a column using spin button | Tyberian1988 | Excel Programming | 2 | 03-10-2014 10:09 PM |
![]() |
hannu | Excel | 3 | 11-14-2013 01:42 AM |
![]() |
revans611 | Word | 1 | 11-29-2010 11:57 AM |
Help with Combination function | sanasath | Excel | 0 | 12-13-2005 07:24 AM |