Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
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
How do I set a pop up window to focus? OverMyHead Excel Discussion (Misc queries) 1 February 9th 10 11:24 PM
how do i center the worksheet in the viewing window? Tripp Excel Discussion (Misc queries) 0 March 2nd 07 03:02 PM
HELP!! Unhide Sheet with Macro and focus on other sheet [email protected] Excel Discussion (Misc queries) 2 May 23rd 06 07:17 PM
Focus sheet Max Potters Excel Programming 3 October 4th 04 06:53 AM
keep focus & window steady Gunnar Johansson Excel Programming 2 June 7th 04 06:13 AM


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

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

About Us

"It's about Microsoft Excel"