Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performance Issue - Adding controls at run-time

Status
Not open for further replies.

rsouthon

Programmer
Nov 14, 2002
10
CA
I'm using VBA to add a control to Word at run-time. I'm using the following code to add a checkbox:

Dim m_shape As InlineShape
Dim WithEvents m_check As MSForms.CheckBox

Set m_shape = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.checkbox.1")

Set m_check = m_shape.OLEFormat.Object


The problem is that they take forever to load. Does anyone know a way to speed this process up? I would also appreciate any alternate ways to add the controls at run-time.

Thanks
 
You can try putting your AddOLEControl inside a With block like this:
[tt]
With Selection.InlineShapes
Set m_shape = .AddOLEControl(ClassType:="Forms.checkbox.1")
End With
[/tt]

But I'm not sure how much it'll gain you (you will gain some speed, however).

Chip H.

 
That doesn't seem to help much. But thanks for the input. If someone knows how to add a control at run time without the ".addOLEControl(ClassType:="Forms.Checkbox.1)" it would help a lot.

Thanks
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top