Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OLEControls Optionbuttons

Hi all,

In an Excel workbook I created a multiplechoice test. On the first sheet
they select the test. On the second sheet they make the questions. The
questions are in cells The possible answers are in Optionbuttons
(OLEControls).
The problem is: After selecting the text the right questions show up, but
the anwers in the captions of the optionsbuttons only show up after clicking
in the worksheet and after a delay of a few secons. There are 300
optionsbuttons (100 questions with 3 possible answers).

The code for filling the controls is (part of a larger procedure):

Do Until rs.EOF
For Each oleObj In wsVragen.OLEObjects
If TypeOf oleObj.Object Is MSForms.OptionButton Then
Set optObj = oleObj.Object
VraagNo = Mid(optObj.Name, 5, Len(optObj.Name) - 5)
AntwoordTeken = Right(optObj.Name, 1)

If rs!Vraagnummer = VraagNo And rs!Antwoordletter =
AntwoordTeken Then
oleObj.Visible = True
optObj.Caption = rs!Antwoord & ""
End If
End If
Next oleObj
rs.MoveNext
Loop
rs.MoveFirst

Vraag = Dutch for Question
Antwoord = Dutch for Answer

The question is: Why are the captions of the optionbuttons refreshed after
running the code with delay? How Can I solve this problem?

TIA,
Jan Vente


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default OLEControls Optionbuttons

Perhaps the delay is in the record set.

Try commenting out the code that works with the OLEObjects and just steps
through the record set. Does that take close to the same time. If so,
perhaps you can put the recordset into an array and work from that.

--
Regards,
Tom Ogilvy


"Jan Vente" wrote:

Hi all,

In an Excel workbook I created a multiplechoice test. On the first sheet
they select the test. On the second sheet they make the questions. The
questions are in cells The possible answers are in Optionbuttons
(OLEControls).
The problem is: After selecting the text the right questions show up, but
the anwers in the captions of the optionsbuttons only show up after clicking
in the worksheet and after a delay of a few secons. There are 300
optionsbuttons (100 questions with 3 possible answers).

The code for filling the controls is (part of a larger procedure):

Do Until rs.EOF
For Each oleObj In wsVragen.OLEObjects
If TypeOf oleObj.Object Is MSForms.OptionButton Then
Set optObj = oleObj.Object
VraagNo = Mid(optObj.Name, 5, Len(optObj.Name) - 5)
AntwoordTeken = Right(optObj.Name, 1)

If rs!Vraagnummer = VraagNo And rs!Antwoordletter =
AntwoordTeken Then
oleObj.Visible = True
optObj.Caption = rs!Antwoord & ""
End If
End If
Next oleObj
rs.MoveNext
Loop
rs.MoveFirst

Vraag = Dutch for Question
Antwoord = Dutch for Answer

The question is: Why are the captions of the optionbuttons refreshed after
running the code with delay? How Can I solve this problem?

TIA,
Jan Vente



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
Moving OptionButtons MarkyB Excel Discussion (Misc queries) 2 March 7th 06 02:50 PM
Choosing Only One Of Three OptionButtons Minitman[_4_] Excel Programming 2 August 18th 05 12:59 PM
Selecting OptionButtons Geoff Excel Programming 9 July 16th 05 06:55 PM
OptionButtons Paul Excel Programming 4 December 4th 03 04:12 PM
optionbuttons Phil Perry Excel Programming 1 July 10th 03 09:13 PM


All times are GMT +1. The time now is 01:31 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"