LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default VBE(Visual Basic Editor) Keep focus in VBE


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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Visual Basic Editor SteveG[_5_] Excel Discussion (Misc queries) 0 March 19th 09 01:46 PM
Visual Basic Editor Ron Rueter Excel Discussion (Misc queries) 3 October 28th 08 02:48 PM
Visual Basic Editor opens bi itself KG Excel Discussion (Misc queries) 0 September 15th 07 04:02 PM
Visual basic editor Answerfactory Excel Discussion (Misc queries) 3 October 9th 06 09:13 PM
Visual Basic Editor Question??? Bob Phillips[_6_] Excel Programming 0 May 5th 05 09:55 AM


All times are GMT +1. The time now is 05:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"