LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Passing Information to and from Forms

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
http://peltiertech.com/Excel/PropertyProcedures.html 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing an Array between Forms? Jason Paris[_2_] Excel Programming 3 June 12th 07 11:56 AM
VBA passing information between differnt User Forms chfa Excel Programming 6 March 27th 07 11:58 AM
passing variables between 2 forms burl_rfc Excel Programming 3 April 14th 06 05:49 AM
Passing variables between forms Sami82[_8_] Excel Programming 7 October 8th 05 12:12 AM
User Forms - passing data between them mickiedevries Excel Programming 3 June 21st 04 08:59 PM


All times are GMT +1. The time now is 02:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"