Phil,
following should work.
NOTE:
There's 1 problem that I dont know how to easily solve
this code limits the movements of the form to the boundaries of the VBE
form.
Option Explicit
Private Declare Function FindWindow Lib "user32.dll" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SetParent Lib "user32.dll" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Property Get Hwnd() As Long
Hwnd = FindWindow(vbNullString, Caption)
End Property
Private Sub UserForm_Initialize()
With Application.VBE.MainWindow
If .Visible And Not .WindowState = 1 Then 'minimized
.SetFocus
Call SetParent(Me.Hwnd, .Hwnd)
End If
End With
Repaint
End Sub
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
phil wrote :
Hi
I have created a xla file. The main purpuse of that file, is to be
able to copy the code lines of the selected VBProject on to the
clipboard. In that file, i have created 2 userforms. The goal of the
first one when called upon, is to present in a TreeView control, all
the Procedure that are present in the selected vbaproject.
Now, the trouble that I have is that when i call the userform(show),
two things occur that I dont Want:
1- I Go back in Excel, insted of staying in VBE
2- When I unload the userform, I dont go back to the Vbaproject that
a selected before I call the Userform, i usually go back to the
vbaproject that contains my userform module.
So:
How I can I stay In vbe, while calling a userform ?
And :
How can I go back to the VbaProject that I was on before calling the
Userform when I unload it from the memorie. (this is how the sequence
end with)
Thank's
Philippe