2 docs open i lose focus but one open and works fine.

F

frogman

Word 2000
Windows 2000 pro

I don't understand what is happening?

basic outline
click on a control
runs through code

if this is the only doc open i can click on another control with no
problem

if more than one doc is open when i click on another control the doc is
activated then i have to click the control again to actually change it.

I have tried to set focus back to the control or activate the doc but
it doesn't seem to work.

CODE
Option Explicit
Dim blnCameFromOpenSub As Boolean

Private Sub cbbInterface_Change()
If blnCameFromOpenSub = True Then
ActiveDocument.cbbInterface.Text =
ActiveDocument.CustomDocumentProperties("Source")
blnCameFromOpenSub = False
Else
ActiveDocument.CustomDocumentProperties("Source") =
Me.cbbInterface.Text
End If

blnCameFromOpenSub = False
End Sub

Private Sub Document_Open()
blnCameFromOpenSub = True
Call FillComboBox
Call cbbInterface_Change
End Sub

Private Sub Document_close()
ActiveDocument.CustomDocumentProperties("Source") =
Me.cbbInterface.Text
End Sub

Private Sub optStep1Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep2Pass_Change()

Call CountPassFail
End Sub
Private Sub optStep3Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep4Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep5Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep6Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep7Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep8Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep9Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep10Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep11Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep12Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep13Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep14Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep15Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep16Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep17Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep18Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep19Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep20Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep21Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep22Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep23Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep24Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep25Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep26Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep27Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep28Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep29Pass_Change()
Call CountPassFail
End Sub
Private Sub optStep30Pass_Change()
Call CountPassFail
End Sub

Public Function CountPassFail()
Dim testtype, testnum As Variant
Dim ctl As InlineShape
Dim dblPass As Double
Dim dblFail As Double
For Each ctl In ActiveDocument.InlineShapes
If ctl.Type = wdInlineShapeOLEControlObject Then
If InStr(ctl.OLEFormat.Object.Name, "Pass") > 0 Then
dblPass = dblPass + ctl.OLEFormat.Object.Value
ElseIf InStr(ctl.OLEFormat.Object.Name, "Fail") > 0 Then
dblFail = dblFail + ctl.OLEFormat.Object.Value
End If
End If
Next

lblTotalP.Caption = -dblPass
lblTotalF.Caption = -dblFail

End Function

Public Function FillComboBox()
Dim cbFill, cbFills
cbFills = Array(" ", "Administration", "Calyx 5.7", "Datatrac 7.7",
"Datatrac 7.8", _
"Datatrac 8.0", "Datatrac 8.0 Wilmington",
"Datatrac 8.1", "MILA", _
"Manual Entry")

For Each cbFill In cbFills
cbbInterface.AddItem cbFill
Next

cbbInterface.ListIndex = 0
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top