By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,045 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,045 IT Pros & Developers. It's quick & easy.

Looping in VB

100+
P: 118
Hey alI, I have the VB code that opens and closes the CD drive

Expand|Select|Wrap|Line Numbers
  1.  
  2. <script language="VBScript">
  3. <!--
  4.  
  5. Sub Close()
  6. Set oWMP = CreateObject("WMPlayer.OCX.7" )
  7. Set colCDROMs = oWMP.cdromCollection
  8.  
  9. if colCDROMs.Count >= 1 then
  10.         For  i = 0 to colCDROMs.Count - 1
  11.                                 colCDROMs.Item(i).Eject
  12.                 Next ' cdrom
  13.  
  14.     For i = 0 to colCDROMs.Count - 1
  15.         colCDROMs.Item(i).Eject
  16.     Next 
  17.  
  18.  
  19. End If
  20.  End Sub
  21.  
  22. -->
  23. </script>
  24.  
Is there anyway that I can add a loop to this so that it will keep doing it, over and over until another button is pressed/another function is called?
Sep 18 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.