I don't know you have found your solution but I can give you other alternative.
You need two forms and a module
then first form frmmodul with text1 textbox and command1 as command
code:
Option Explicit
Private mTransparent As Boolean
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
FormTransparent Me, Array(Timer1)
mTransparent = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Select Case mTransparent
Case False
FormTransparent Me, Array(Timer1)
mTransparent = True
Case True
FormOpaque Me, Array(Timer1)
mTransparent = False
End Select
End Sub
Second Form frmTest with command1 as command-button
Option Explicit
Private Sub Command1_Click()
frmModal.Show vbModal
MsgBox "Nach dem modalen Anzeigen des Forms ausgeführter Code..."
End Sub
and least the module with
Option Explicit
Private Declare Function CreateRectRgn Lib "gdi32" _
(ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" _
(ByVal hWnd As Long, ByVal hrgn As Long, _
ByVal Redraw As Boolean) As Long
Public Sub FormTransparent(Form As Form, _
Optional DoNotTouchEnabledControls As Variant)
Dim nRgn As Long
nRgn = CreateRectRgn(0, 0, 0, 0)
SetWindowRgn Form.hWnd, nRgn, True
zEnable False, Form, DoNotTouchEnabledControls
End Sub
Public Sub FormOpaque(Form As Form, _
Optional DoNotTouchEnabledControls As Variant)
Dim nControl As Control
Dim nControls() As Control
Dim i As Integer
zEnable True, Form, DoNotTouchEnabledControls
With Form
SetWindowRgn .hWnd, 0, True
ReDim nControls(0 To .Controls.Count)
On Error Resume Next
For Each nControl In .Controls
Set nControls(nControl.TabIndex) = nControl
Next
End With
Err.Clear
For i = 0 To UBound(nControls)
With nControls(i)
.SetFocus
If Err.Number Then
Err.Clear
Else
Exit For
End If
End With
Next 'i
End Sub
Private Sub zEnable(ByVal Enabled As Boolean, Form As Form, _
Optional DoNotTouchEnabledControls As Variant)
Dim nControl As Control
Dim nControls As Collection
Dim i As Integer
Dim nControlsA() As Control
Set nControls = New Collection
If Not IsMissing(DoNotTouchEnabledControls) Then
For i = LBound(DoNotTouchEnabledControls) To _
UBound(DoNotTouchEnabledControls)
nControls.Add DoNotTouchEnabledControls(i), _
CStr(ObjPtr(DoNotTouchEnabledControls(i)))
Next
End If
On Error Resume Next
With Form
For Each nControl In Form.Controls
nControls.Add nControl, CStr(ObjPtr(nControl))
If Err.Number = 0 Then
nControl.Enabled = Enabled
End If
Err.Clear
Next
.Enabled = Enabled
End With
End Sub
Waiting for your comments
peterguhl@yahoo.de