Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Passing Information to and from Forms
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="dtshedd, post: 6450817"] My goal; have the user select choices on a page of checkboxes and capture the labels for those boxes and concatenate them into one large string. When I use brute force like multiple if then statements in the property definition behind the form to check the value of a each checkbox by name for true/false ala if chkBoxPrimary=True then MyBins=MyBins+"Primary" then everything works. Problem is i have 50 checkboxes so I want to capture the caption and add that to my string. so I cycle thru the checkboxes and if they are true I add the caption. unfortunately i get an error ' object doesn't support the property or method' the offending line the regular code module is Application.ActiveCell = .MyBins I have followed the very informative tutorial at [URL]http://peltiertech.com/Excel/PropertyProcedures.html[/URL] to pass information from a form. The following is in a regular code module Option Base 1 Sub GetRecipients() Dim frmGetBins As FGetBins 'start up the form Set frmGetBins = New FGetBins With frmGetBins 'show the form .Show 'get new value back from the form Application.ActiveCell = .MyBins End With 'got the information, now close the form Unload frmGetBins End Sub Here is the code behind the form: Public Property Get MyBins() As String Dim c As Control For Each c In Me.Controls If TypeName(c) = "CheckBox" And c.Value = True Then MyBins = MyBins + Trim(c.Caption.Text) +" " End If Next End Property Private Sub CommandButtonFinished Click() Me.Hide End Sub Private Sub CommandButtonReset Click() Dim c As Control For Each c In Me.Controls If TypeName(c) = "CheckBox" Then c.Value = False End If Next End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then , user clicked the X button , cancel unloading the form, use close button procedure instead Cancel = True CommandButtonFinished Click End If End Sub any help appreciated [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Passing Information to and from Forms
Top