Log in

View Full Version : Combo Box in Mail Merged document



markbristoll
07-23-2010, 10:56 AM
I have created a mail merge document with a drop-down combo box that will be used by the user after the document has merged.
When I merge the documents the options in the combo box are not available to the user.When I switch to design view, within the merged document, the vba code I wrote is gone.
Can someone advise on how i can have the vba code available for use in the merged document.
The code I am using is as follows:
Public Sub ComboBox1_Change()
End Sub
Public Sub ComboBox1_DropButtonClick()
Me.ComboBox1.List = Array("Green", "Red", "Blue")
End Sub
Public Sub Document_Open()
Dim vColor, vColors
vColors = Array("Green", "Red", "Blue")
For Each vColor In vColors
ComboBox1.AddItem vColor
ComboBox2.AddItem vColor
ComboBox3.AddItem vColor
Next
ComboBox1.ListIndex = 0
ComboBox2.ListIndex = 0
ComboBox3.ListIndex = 0
End Sub
Public Sub ComboBox2_Change()
End Sub
Public Sub ComboBox2_DropButtonClick()
Me.ComboBox2.List = Array("Green", "Red", "Blue")
End Sub
Public Sub ComboBox3_Change()
End Sub
Public Sub ComboBox3_DropButtonClick()
Me.ComboBox3.List = Array("Green", "Red", "Blue")
End Sub
All help would be appreciated.
Mark

Tinbendr
07-24-2010, 02:53 AM
I have created a mail merge document ...
When I merge the documents the options in the combo box are not available to the user.When I switch to design view, within the merged document, the vba code I wrote is gone.
Yes, that is correct. The merged document will not have any code in it.

You'll have to add it on the fly, or post merge or import the code.

Read this article (http://support.microsoft.com/kb/292037) from Microsoft.

I'm not very familiar with Project level coding. Maybe someone else can help with the code. I'll work on it as time permits.