Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
checkbox that controls macros??? childofthe1980s Setting up and Configuration of Excel 0 March 6th 07 12:40 PM
Can you perform Math functions with ActiveX Checkbox controls? ForTor69 Excel Worksheet Functions 1 May 18th 06 05:23 PM
CheckBox and ComboBox controls move on previewing or printing Stephen W. Hiemstra Excel Programming 1 November 13th 04 02:02 AM
Dynamic controls Martin Walke Excel Programming 5 September 29th 04 12:15 PM
Dynamic Label for Controls Rob Bovey Excel Programming 0 September 8th 03 06:47 PM


All times are GMT +1. The time now is 03:33 PM.

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

About Us

"It's about Microsoft Excel"