PDA

View Full Version : Command Button to extract data from UserForm



LLL
02-25-2009, 03:40 PM
I have a WorkBook in which I have created several userforms, which
thankfully are working well. The userforms contain checkboxes. What I would like to do is create a command button on those forms.

When clicking this button, I would like for the unchecked boxes to be populated onto a word document. Is this
possible to do? Can anyone direct me on getting started?

lucas
02-25-2009, 04:01 PM
What is it you want to put on a word document? The label values of the checkboxes, whether they are checked or not or what exactly?

LLL
02-25-2009, 04:07 PM
I would like the label values and whether they are checked or not. Would it help to see the sheet? I will attach. The forms are in L, N, O, P, and Q

lucas
02-26-2009, 12:30 AM
I couldn't get your file to run. You really need to put option explicit at the top of each module.....see attachment, and declare your variable, etc.


See if this gives you an idea of how you might go about it.....see attached.

LLL
02-26-2009, 05:03 AM
Thank you Lucas for your help. I am working with the example you provided now. Very Helpful!!!:hi:

LLL
02-26-2009, 05:48 AM
Private Sub CommandButton1_Click()
Dim Appword As New Word.Application

There is an error saying "user-defined typed not defined" when I utilize this code in my sheet...Where do I define the object and how? Thanks

lucas
02-26-2009, 08:54 AM
If you had read the comments in the code you would have noticed this line:

'This code requires a referece to the Word object model

Which means that in the vbe you need to go to tools-referenced and put a check next to the

microsoft word 11.0 object library

11.0 may vary depending on which version of Excel you are using. 11.0 is what you would see if you are using Excel 2003. If it is an earlier version it might be 10.0, etc.

LLL
02-26-2009, 09:35 AM
I got it!! YEAAA...THANK you THANK YOU:bow: