Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Adjust position of a commandbar

I am using Excel 2003 with Windows XP.

I want to make the top left corner of a custom toolbar appear on the screen
in line with the top left corner of cell "A1".

I have tried using "Top = 0" and "Left = 0", which is where the top and left
of cell A1 is, but this doesn't work on the toolbar, which appears near
center of the screen. This toolbar is deleted and rebuilt on each execution
based on other data.

Can someone please clue me in on what I am doing wrong? All I need is for it
to appear in the correct position...thanks.

Thanks much in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Adjust position of a commandbar

Try the following. Works for me. Do not execute from the VBE or the VBE Main
Window will serve as the ActiveWindow.

Sub PositionCB()
Dim x As Single, y As Single
With ActiveWindow
x = .PointsToScreenPixelsX(0)
y = .PointsToScreenPixelsY(0)
End With
With CommandBars("Custom 1")
.Left = x
.Top = y
End With
End Sub

Regards,
Greg


"quartz" wrote:

I am using Excel 2003 with Windows XP.

I want to make the top left corner of a custom toolbar appear on the screen
in line with the top left corner of cell "A1".

I have tried using "Top = 0" and "Left = 0", which is where the top and left
of cell A1 is, but this doesn't work on the toolbar, which appears near
center of the screen. This toolbar is deleted and rebuilt on each execution
based on other data.

Can someone please clue me in on what I am doing wrong? All I need is for it
to appear in the correct position...thanks.

Thanks much in advance.

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
Dim as CommandBar Does not Work Omar Excel Programming 6 February 7th 05 03:37 PM
CommandBar Controls Simon Shaw[_5_] Excel Programming 3 December 28th 04 05:05 PM
Add-In needs to create CommandBar lucp Excel Programming 8 June 27th 04 01:46 PM
commandbar Greg Prost[_2_] Excel Programming 2 November 21st 03 11:42 AM
Add control to commandbar Dan[_20_] Excel Programming 2 August 27th 03 04:47 PM


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