Modeless Behavior from within VB for Word COM AddIn w/ Certain Modal Functionality?

T

TMan

Hey Folks,

I'm sure that you are all well acquainted with how when one uses a modal
form from within Word VBA or the VB environment, one stays within that
routine until the form is closed and the routine can continue. The opposite
is, of course, true when using a modeless form from within Word VBA or the
VB environment (i.e. the code will run completely through the routine).

However, if one loads a VBA form as modal and then, say, clicks a button
that runs such code as below:



Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function EnableWindow Lib "user32" (ByVal hWnd As Long,
ByVal fEnable As Long) As Long

Public Sub Enabler
'Make the form modeless by enabling Word
EnableWindow FindWindow("OpusApp", Application.Caption), True
End Sub


The behavior will be to make the form modeless such that the user can move
about in Word but the code will not run until the form is unloaded.

I want to create this same behavior from within the VB environment but it is
not working.

Any suggestions?

Thanks & Regards,

TC
 

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