Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Command Bars

Hello,
I posted this early but it didn't show on my window for some reason.

Hello,
Is there a way to control where a command bar is placed when you add one. I
have a sheet that, when activated, a command bar is added. I want it to be
in the upper left hand corner of the worksheet.

Thanks.

Bill



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Command Bars

To position to top-left corner of worksheet as opposed to the window. Don't
execute from the VBE or the VBE Window will serve as the ActiveWindow:

Sub PositionToWorksheet()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = .PointsToScreenPixelsY(0)
cb.Left = .PointsToScreenPixelsX(0)
End With
cb.Visible = True
End Sub

To position to top-left corner of window as opposed to the worksheet:

Sub PositionToWindow()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = 0
cb.Left = 0
End With
cb.Visible = True
End Sub

Regards,
Greg



"Bill" wrote:

Hello,
I posted this early but it didn't show on my window for some reason.

Hello,
Is there a way to control where a command bar is placed when you add one. I
have a sheet that, when activated, a command bar is added. I want it to be
in the upper left hand corner of the worksheet.

Thanks.

Bill




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Command Bars

Thanks Greg. This works great for a chart. Puts the bar in the upper left
hand corner of the chart. But for a worksheet it puts it at the top of the
window.

Any ideas why?

Bill



"Greg Wilson" wrote in message
...
To position to top-left corner of worksheet as opposed to the window.
Don't
execute from the VBE or the VBE Window will serve as the ActiveWindow:

Sub PositionToWorksheet()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = .PointsToScreenPixelsY(0)
cb.Left = .PointsToScreenPixelsX(0)
End With
cb.Visible = True
End Sub

To position to top-left corner of window as opposed to the worksheet:

Sub PositionToWindow()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = 0
cb.Left = 0
End With
cb.Visible = True
End Sub

Regards,
Greg



"Bill" wrote:

Hello,
I posted this early but it didn't show on my window for some reason.

Hello,
Is there a way to control where a command bar is placed when you add one.
I
have a sheet that, when activated, a command bar is added. I want it to
be
in the upper left hand corner of the worksheet.

Thanks.

Bill






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Command Bars

My mistake Greg. It works.

Bill


"Bill" wrote in message
nk.net...
Thanks Greg. This works great for a chart. Puts the bar in the upper
left hand corner of the chart. But for a worksheet it puts it at the top
of the window.

Any ideas why?

Bill



"Greg Wilson" wrote in message
...
To position to top-left corner of worksheet as opposed to the window.
Don't
execute from the VBE or the VBE Window will serve as the ActiveWindow:

Sub PositionToWorksheet()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = .PointsToScreenPixelsY(0)
cb.Left = .PointsToScreenPixelsX(0)
End With
cb.Visible = True
End Sub

To position to top-left corner of window as opposed to the worksheet:

Sub PositionToWindow()
Dim cb As CommandBar
Set cb = Application.CommandBars.Add("Test", Temporary:=True)
With ActiveWindow
cb.Top = 0
cb.Left = 0
End With
cb.Visible = True
End Sub

Regards,
Greg



"Bill" wrote:

Hello,
I posted this early but it didn't show on my window for some reason.

Hello,
Is there a way to control where a command bar is placed when you add
one. I
have a sheet that, when activated, a command bar is added. I want it to
be
in the upper left hand corner of the worksheet.

Thanks.

Bill








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
Command Bars KneeDown2Up Excel Discussion (Misc queries) 4 January 16th 07 05:43 PM
Command Bars Bill[_30_] Excel Programming 1 October 5th 05 08:16 PM
Command Bars Neil Hopkinson[_2_] Excel Programming 3 August 19th 05 09:53 AM
Command Bars nath Excel Programming 2 August 23rd 04 01:45 PM
command bars Geo Siggy[_16_] Excel Programming 6 April 22nd 04 10:50 AM


All times are GMT +1. The time now is 10:27 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"