ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set focus on sheet and keep viewing vba window (https://www.excelbanter.com/excel-programming/335842-set-focus-sheet-keep-viewing-vba-window.html)

helmekki[_83_]

Set focus on sheet and keep viewing vba window
 

Hi there

Is there a way in Excel VBA to change focus from a VBA window t
sheet1, programmically?? I want to be able to see the VBA window whil
being able to type into sheet1 of Exce

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=39117


okaizawa

Set focus on sheet and keep viewing vba window
 
Hi,
one way:

Application.VBE.CommandBars.FindControl(ID:=106).E xecute
Sheet1.Activate

i suppose 'Alt-F11' would be enough usually.

--
HTH,
okaizawa

helmekki wrote:
Hi there

Is there a way in Excel VBA to change focus from a VBA window to
sheet1, programmically?? I want to be able to see the VBA window while
being able to type into sheet1 of Excel



Norman Jones

Set focus on sheet and keep viewing vba window
 
Hi Helmekki,


I want to be able to see the VBA window while
being able to type into sheet1 of Excel


Why not simply resize the Excel and VBE windows and arrange them to suit?


---
Regards,
Norman



"helmekki" wrote in
message ...

Hi there

Is there a way in Excel VBA to change focus from a VBA window to
sheet1, programmically?? I want to be able to see the VBA window while
being able to type into sheet1 of Excel


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=391170




okaizawa

Set focus on sheet and keep viewing vba window
 
if you want to set the vbe window to topmost, try this:

Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2

Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

Sub VBETopMost()
SetWindowPos Application.VBE.MainWindow.hWnd, _
HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Sub

Sub VBETopMost_Off()
SetWindowPos Application.VBE.MainWindow.hWnd, _
HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
End Sub

--
HTH,

okaizawa

Norman Jones

Set focus on sheet and keep viewing vba window
 
Hi Helmekki,

Something like:

Sub TestIt()

With Application.VBE.MainWindow
.Left = 0
.Top = 0
.Width = 600
.Height = 800
.Left = 500
End With

With Application
.WindowState = xlNormal
.Left = 0
.Top = 0
.Width = 470
.Height = 800
End With

End Sub


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Helmekki,


I want to be able to see the VBA window while
being able to type into sheet1 of Excel


Why not simply resize the Excel and VBE windows and arrange them to suit?


---
Regards,
Norman



"helmekki" wrote
in message ...

Hi there

Is there a way in Excel VBA to change focus from a VBA window to
sheet1, programmically?? I want to be able to see the VBA window while
being able to type into sheet1 of Excel


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread:
http://www.excelforum.com/showthread...hreadid=391170






helmekki[_84_]

Set focus on sheet and keep viewing vba window
 

Thank u all, okaizawa, your code is what i need, it works very wel

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=39117



All times are GMT +1. The time now is 02:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com