View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy[_7_] Doug Glancy[_7_] is offline
external usenet poster
 
Posts: 55
Default Adding "additional" controls programatically

Andy,

Your post reminded me that even though Intellisense doesn't show a property
for a control, e.g., ".top" it might still be available. I do wonder
though, why "top" didn't show for my earlier example of an MSForms.Button,
but did when I cast it as a Control? Anyways, a good reminder not to rely
too much on the IDE features, although generally I'd be lost without them.

Doug

"Andy Pope" wrote in message
...
Hi,

This works for me. Adds progress bar to userform and when the form is
clicked will do a simple 1 to 100 prorgess.

Private m_objPBar As Object
Private Sub UserForm_Click()

Dim lngIndex As Long
Dim lngLoop As Long

m_objPBar.Value = 0
For lngIndex = 1 To 100
For lngLoop = 1 To 599999
Next
m_objPBar.Value = m_objPBar.Value + 1
Next

End Sub
Private Sub UserForm_Initialize()

Set m_objPBar = _
Me.Controls.Add("MSComctlLib.ProgCtrl.2", "myProg", True)

With m_objPBar
.Top = 5
.Left = 5
.Width = Me.InsideWidth - 10
.Height = 15
.Value = 0
End With

End Sub

Cheers
Andy

What-A-Tool wrote:
"Bob Phillips" wrote in message
...

If you want a progress bar, as you note there is no built-in control
(there may be commercial controls, but I know of none), but you could
just add the usual type of progress indicator as described here
http://www.enhanceddatasystems.com/E...rogressBar.htm

--
---
HTH

Bob



So you are saying there is no way to programatically add the Microsoft
ProgressBar Control, Version 5.0 or Version 6.0, that I have available in
the "Addtional Controls" dialog box accesible from the tools menu? These
controls are contained in comctl32.ocx, or MSCOMCTL.OCX, respectively. Is
there a way to programatically create a reference to 1 of these .ocx
files, and add the control from there?

Thanks Bob -
Sean