Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Hi all, I am new to this VBA area. I have a situation where in I need to create CheckBox Dynamically. For Example. If the Sql statement reterieves three row i should display thre checkBox on the same line along with the results. Can Some one helpme out with the same -- akkuru ----------------------------------------------------------------------- akkurup's Profile: http://www.excelforum.com/member.php...fo&userid=2831 View this thread: http://www.excelforum.com/showthread.php?threadid=47903 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Here is some code that creates forms toolbar checkboxes
With ActiveSheet .CheckBoxes.Add(372.75, 46.5, 126, 63).Select Selection.OnAction = "Macro1" .CheckBoxes.Add(482.75, 46.5, 126, 63).Select Selection.OnAction = "Macro1" .CheckBoxes.Add(592.75, 46.5, 126, 63).Select Selection.OnAction = "Macro1" End With -- HTH RP (remove nothere from the email address if mailing direct) "akkurup" wrote in message ... Hi all, I am new to this VBA area. I have a situation where in I need to create CheckBox Dynamically. For Example. If the Sql statement reterieves three row i should display three checkBox on the same line along with the results. Can Some one helpme out with the same. -- akkurup ------------------------------------------------------------------------ akkurup's Profile: http://www.excelforum.com/member.php...o&userid=28316 View this thread: http://www.excelforum.com/showthread...hreadid=479030 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
let me start with "Thanks" here's what iam doing I am connecting to a database and reteriving the data. Select emp,Empname from emp; When i display the data I thought that i will have checkboxes als displayed along with each rows i displayed. I am successful in displaying data, but iam iam having trouble with th checkboxes -- akkuru ----------------------------------------------------------------------- akkurup's Profile: http://www.excelforum.com/member.php...fo&userid=2831 View this thread: http://www.excelforum.com/showthread.php?threadid=47903 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Can you post all your code as I am struggling to visualise it?
-- HTH RP (remove nothere from the email address if mailing direct) "akkurup" wrote in message ... let me start with "Thanks" here's what iam doing I am connecting to a database and reteriving the data. Select emp,Empname from emp; When i display the data I thought that i will have checkboxes also displayed along with each rows i displayed. I am successful in displaying data, but iam iam having trouble with the checkboxes. -- akkurup ------------------------------------------------------------------------ akkurup's Profile: http://www.excelforum.com/member.php...o&userid=28316 View this thread: http://www.excelforum.com/showthread...hreadid=479030 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Hi Bob, Here's the Code In Here Iam Show the data in Column B and C. I want to Provide a Checkbox In Column "A" for each row I am Using Oracle OO4O driver for connecting to the database and reterieve the data. Sub Reterieve_data() Dim strSQL As String Dim strResult As String Dim OraDynaSet As Object Dim i As Integer strSQL = "select ename, empno from emp" Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&) If OraDynaSet.RecordCount 0 Then 'There were records retrieved OraDynaSet.MoveFirst For i = 1 To OraDynaSet.RecordCount ActiveSheet.Cells(i, 2) = OraDynaSet.Fields(0).Value ActiveSheet.Cells(i, 3) = OraDynaSet.Fields(1).Value OraDynaSet.MoveNext Next i End If End Sub -- akkurup ------------------------------------------------------------------------ akkurup's Profile: http://www.excelforum.com/member.php...o&userid=28316 View this thread: http://www.excelforum.com/showthread...hreadid=479030 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Where do you want the checkboxes? Assuming beyind A & B
Sub Reterieve_data() Dim strSQL As String Dim strResult As String Dim OraDynaSet As Object Dim i As Integer strSQL = "select ename, empno from emp" Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&) If OraDynaSet.RecordCount 0 Then 'There were records retrieved OraDynaSet.MoveFirst For i = 1 To OraDynaSet.RecordCount With ActiveSheet .Cells(i, 2) = OraDynaSet.Fields(0).Value .Cells(i, 3) = OraDynaSet.Fields(1).Value .CheckBoxes.Add(Cells(i, "D").Left, Rows(i).Top, 126, 18).Select Selection.Caption = "Y/N?" Selection.OnAction = "Macro1" .CheckBoxes.Add(Cells(i, "E").Left, Rows(i).Top, 126, 18).Select Selection.Caption = "Y/N?" Selection.OnAction = "Macro1" End With OraDynaSet.MoveNext Next i End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "akkurup" wrote in message ... Hi Bob, Here's the Code In Here Iam Show the data in Column B and C. I want to Provide a Checkbox In Column "A" for each row I am Using Oracle OO4O driver for connecting to the database and reterieve the data. Sub Reterieve_data() Dim strSQL As String Dim strResult As String Dim OraDynaSet As Object Dim i As Integer strSQL = "select ename, empno from emp" Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&) If OraDynaSet.RecordCount 0 Then 'There were records retrieved OraDynaSet.MoveFirst For i = 1 To OraDynaSet.RecordCount ActiveSheet.Cells(i, 2) = OraDynaSet.Fields(0).Value ActiveSheet.Cells(i, 3) = OraDynaSet.Fields(1).Value OraDynaSet.MoveNext Next i End If End Sub -- akkurup ------------------------------------------------------------------------ akkurup's Profile: http://www.excelforum.com/member.php...o&userid=28316 View this thread: http://www.excelforum.com/showthread...hreadid=479030 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dynamic Controls (CheckBox) using VBA in Excel
Hi Bob, Thanks !!!!!!!!!! That was wonderful. I just tried you tip yes it works. Just Wondering!!!! Regards & Thanks Anil -- akkurup ------------------------------------------------------------------------ akkurup's Profile: http://www.excelforum.com/member.php...o&userid=28316 View this thread: http://www.excelforum.com/showthread...hreadid=479030 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
checkbox that controls macros??? | Setting up and Configuration of Excel | |||
Can you perform Math functions with ActiveX Checkbox controls? | Excel Worksheet Functions | |||
CheckBox and ComboBox controls move on previewing or printing | Excel Programming | |||
Dynamic controls | Excel Programming | |||
Dynamic Label for Controls | Excel Programming |