Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Command Bars | Excel Discussion (Misc queries) | |||
Command Bars | Excel Programming | |||
Command Bars | Excel Programming | |||
Command Bars | Excel Programming | |||
command bars | Excel Programming |