ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Control Checkbox (https://www.excelbanter.com/excel-programming/273812-vba-control-checkbox.html)

Tommy[_6_]

VBA Control Checkbox
 
I am writing an application by VBA with Access. In the
program, I need to get info from Access DB and put into an
Excel file. For normal cells, it's ok to put text in it.
But there are some check boxs on the Excel sheet, how do i
control checkbox value inside VBA code?

Thanks!


Tommy

Ron de Bruin

VBA Control Checkbox
 
Hi Tommy

Me.CheckBox1.Value = False

Or

Me.CheckBox1.Value = True


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tommy" wrote in message ...
I am writing an application by VBA with Access. In the
program, I need to get info from Access DB and put into an
Excel file. For normal cells, it's ok to put text in it.
But there are some check boxs on the Excel sheet, how do i
control checkbox value inside VBA code?

Thanks!


Tommy




Mike[_37_]

VBA Control Checkbox
 
Try worksheet("Sheet1").checkbox1.value = false...

where you substitute your sheet's name for Sheet1.

I understand the use of me.checkbox1 would apply to say code that's running
from a form that has checkbox1 on the form... kind of like thisworkbook for
forms. or to paste from the help file (which makes me think my personal
definition was wrong)
The Me keyword behaves like an implicitly declared variable. It is
automatically available to every procedure in a class module. When a class
can have more than one instance, Me provides a way to refer to the specific
instance of the class where the code is executing. Using Me is particularly
useful for passing information about the currently executing instance of a
class to a procedure in another module. For example, suppose you have the
following procedure in a module:

Sub ChangeFormColor(FormName As Form)
FormName.BackColor = RGB(Rnd * 256, Rnd * 256, Rnd * 256)
End Sub
You can call this procedure and pass the current instance of the Form class
as an argument using the following statement:

ChangeFormColor Me
"tommy" wrote in message
...
The Excel is created by somebody else, when I open the
Excel I can see the name like "check box 1".... for each
check box. In VB editor, I type me. then the drop down
list does not show those check box names, when i use the
name, it get compiled error.

Thanks for you help!

Tommy

-----Original Message-----
Hi Tommy

Me.CheckBox1.Value = False

Or

Me.CheckBox1.Value = True


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tommy" wrote in message

...
I am writing an application by VBA with Access. In the
program, I need to get info from Access DB and put into

an
Excel file. For normal cells, it's ok to put text in it.
But there are some check boxs on the Excel sheet, how

do i
control checkbox value inside VBA code?

Thanks!


Tommy



.





All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com