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
|