Even if you're pretty certain that your way isn't the best way, sometimes it's just easier to go with what you know instead of struggling with something new. I'm pretty sure that's what the author of today's code (found in the Sidebar) was thinking. He knew that to register a OCX library, you click the Start Button, then press R (for Run), then type in -- well, you get the idea.

Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, 
                                              ByVal dy As Long, ByVal cButtons As Long, 
                                              ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10

Private Sub Register(OCXName As String)
  SetCursorPos 32, Screen.Height / 15 - 10
  mouse_event MOUSEEVENTF_ABSOLUTE, 32, Screen.Height / 15 - 10, 1, 1
  mouse_event MOUSEEVENTF_LEFTDOWN, 32, Screen.Height / 15 - 10, 1, 1
  mouse_event MOUSEEVENTF_LEFTUP, 32, Screen.Height / 15 - 10, 1, 1
  SendKeys ("R")
  SendKeys ("regsvr32 " & OCXName)
  SendKeys (vbKeyReturn)
End Sub