Posts: 37
Threads: 17
Joined: Mar 2005
I have an excel spreadsheet that has 2 checkboxes on it. QM asks a yes no question. Depending on the answer I want one of the checkbox filled in. Can I do this?
Thanks as always.
Posts: 37
Threads: 17
Joined: Mar 2005
I finally have a sample of what I want to to in VBA, since the checkbox is an active X box I know there has to be a way to use QM to manipulate it. Here is the VBA code I have working:
Select Case Sheet1.cb1.Value
Case True
MsgBox "true"
Case False
MsgBox "false"
End Select
Sheet1.cb1.Value = "False"
The last line is really what I want to do. How do I do this in QM?
Thanks!
Posts: 12,072
Threads: 140
Joined: Dec 2002
You can run Excel macros from QM. Example:
QM
typelib Excel {00020813-0000-0000-C000-000000000046} 1.2 0 1
Excel.Application a._getactive; err act; act; a._getactive
word bChecked=TRUE
a.Run("Macro1" bChecked)
Excel
Sub Macro1(ByVal bCheck As Boolean)
MsgBox bCheck
End Sub
Posts: 37
Threads: 17
Joined: Mar 2005
Thank you. But I am not trying to run an Excel macro from QM, but replace it. I actually have about 50 (or more) checkboxes I am trying to fill in automatically and would rather do it from QM then Excel.
Thanks again.
Posts: 37
Threads: 17
Joined: Mar 2005
Actually this will work. I will need to pass a variable to Excel and then it will work.
Thanks
Posts: 12,072
Threads: 140
Joined: Dec 2002
The same in QM:
typelib Excel {00020813-0000-0000-C000-000000000046} 1.2 0 1
Excel.Application a._getactive; err act; act; a._getactive
IDispatch ws=a.ActiveSheet
int v=ws.CheckBox1.Value
sel v
,case -1 mes "True"
,case 0 mes "False"
ws.CheckBox1.Value=0 ;;can be 0 or 1 or 2