singeredel was telling us:
singeredel nous racontait que :
Thanks so much for your help so far!
The add-in program seems to allow me to click in the document and
edit, etc., although the dialogue box does not go to the background
out of sight, so perhaps this is modeless? If so, I do not know what
this means to the programming.
Yes, if the dialog box stays on screen and also allows you to interact with
other windows, such as the document window, then it is modeless.
When a modeless form is displayed, the rest of the code executes while the
form is displayed. That is the purpose of modeless forms.
The few times I have worked with modeless forms, I created them for a
specific purpose and I was in control of the whole thing. In this case, you
do not have access to the code behind the form itself... so, I think, that
complicates things a bit.
Also, I did try typing "DoEvents" after the line calling the line
counting macro, but it did not seem to make any difference. I did
No, in this case it would not help.
Try this:
Instead of the DoEvents line I suggested earlier, insert this code right
after the call to the Add-in macro that counts line:
'_______________________________________
Dim nrUserForms As Long
nrUserForms = UserForms.Count
Do While nrUserForms = 1
If UserForms(0).Caption = "myFormOK" Then
Pause 0.5
End If
nrUserForms = UserForms.Count
Loop
'_______________________________________
The longer the number after Pause, the longer the delay that might occur
between the time the user closes the dialog and when the rest of your code
restarts executing.
Also, change "myFormOK" for the dialog title (The title you see in the title
bar of the line courting add-in dialog box).
Finally, make sure there are no other dialog box running.... and I hope that
the people who created the line courting add-in wrote clean code, otherwise
you might have problems if you run the code a few times back to back...
<Crossing my fingers for you!>
Then add this sub at the end of your module:
'_______________________________________
Sub Pause(ByVal fSeconds As Single, _
Optional ByVal AllowEvents As Boolean = True)
' By Frank Carr
' Pause execution for specified # of seconds [fSeconds]
'
Dim fTimer As Single ' intial timer value
fTimer = Timer
Do While Timer - fTimer < fSeconds
If AllowEvents Then
DoEvents
End If
'
' if we cross midnight, back up one day
'
If Timer < fTimer Then
fTimer = fTimer - 86400 'one day in seconds 24*60*60
End If
Loop
End Sub
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org