![]() |
#1
|
|||
|
|||
![]()
Hello everyone. I hope I word this issue so you can understand what I am trying to accomplish and assist if you can. I created a document that has merge fields and a userform to complete the merged document. I use AutoOpen in a macro to show the userform (Myform.show) and vba to add data per the user selection. It works perfect if I am using on a file with only one party listed in the db. Problem is, if there are more than one parties listed in the db for the file I am merging, the document opens for each listed party and because I have AutoOpen, so does the userform. Is there a way I can have the userform open only once, even if there are multiple parties, but the data the user selects when the userform opens applied to all?
Scenario 4 parties in my file. Userform opens and ask, Question - Is this a renewal? Response = Yes. Selection from drop down list - First Renewal, Second Renewal, Third Renwal. If user selects Second Renewal, how can I have Second Renewal applied each of the four times the document opens without having the form open each time and making the same selection 4 times? Here is the vba I am using. Private Sub Cmdone_Click() If Cbparty = "Yes" Then With ActiveDocument .Bookmarks("Renew1").Range _ .InsertBefore (Cbrenew) .Bookmarks("Renew2").Range _ .InsertBefore (Cbrenew) .Bookmarks("Renew3").Range _ .InsertBefore (Cbrenew) End With End If Me.Hide End Sub Private Sub UserForm_Initialize() Cbparty.AddItem "Yes" Cbparty.AddItem "No" Cbparty.Value = "Select One" Cbrenew.AddItem "Renewal " Cbrenew.AddItem "Second Renewal " Cbrenew.AddItem "Third Renewal " Cbrenew.Value = "Select One" End Sub Private Sub Cbparty_Change() If Cbparty = "Yes" Then Cbrenew.Top = 40 Lbnew.Top = 43 Cmdone.Top = 75 Me.Height = 125 Me.Width = 243 ElseIf Cbparty = "No" Then Cbrenew.Top = 150 Cbrenew.Value = "Select One" Lbnew.Top = 153 Cmdone.Top = 48 Me.Height = 108 Me.Width = 243 End If End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
snot369 | Word | 1 | 01-13-2017 11:04 AM |
![]() |
jpaul | Word | 1 | 03-09-2015 01:23 PM |
Word no longer allows multiple documents to be open | Steve's Computer | Word | 1 | 03-22-2014 01:55 PM |
![]() |
MrSnrub | Word | 4 | 06-19-2013 07:32 AM |
![]() |
Oliver Beirne | Word VBA | 2 | 04-24-2012 04:49 AM |