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

I have a commandbar that is created by VBA code. I want it displayed in a
particular location, with a height and width of my choosing.

Can't figure out the syntax to refer to the commandbar and its properties.

Thankyou in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Commandbar Positioning

I was able to use some of what you provided, but I am not able to change the
height or width of the toolbar to show all the buttons. Any further ideas?

Here is the code I'm running...

With Application.CommandBars.Add
.Name = "FaceID1"
.Left = 30
.Top = 115
.Height = 308
.Width = 903
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Commandbar Positioning

How many buttons are you adding? It is not normally neccessary to size
the toolbar - it will automatically stretch to show all the buttons.

Regards
Rowan

PosseJohn wrote:
I was able to use some of what you provided, but I am not able to change the
height or width of the toolbar to show all the buttons. Any further ideas?

Here is the code I'm running...

With Application.CommandBars.Add
.Name = "FaceID1"
.Left = 30
.Top = 115
.Height = 308
.Width = 903
.Protection = msoBarNoProtection
.Visible = True
.Position = msoBarFloating
End With

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Commandbar Positioning

I am running a routine that adds face ID's to the toolbar, so that I can
'see' which one I would like to use in/for my apps. I am creating 2 toolbars
that contain 500 buttons each.

I change the .toolbartip to the face ID number, .onaction = xlnone.

Seems extreme, but it allows me to select the face ID's easily.

The .top and .left properties seem to be working, just the .height and
..width are not working at all.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Commandbar Positioning

There are a number of free addins available that do this already. I use
Jim Rech's BtnFaces which you can get here
http://www.BMSLtd.ie/MVP/Default.htm

The code below from RB Smissaert places all the faceids onto the
activesheet (make sure this is a blank sheet):

'----------------------------------------------------------
Sub ShowAllFaceID()

Dim CBC As CommandBarControl
Dim i As Long
Dim n As Long
Dim c As Long
Dim strSpacer As String
Dim lFaceIDCount As Long
Dim Sh As Shape

Application.ScreenUpdating = False
Application.Cursor = xlWait
strSpacer = "~" & String(3, Chr(32))
Cells.Clear

'get rid of the old FaceID's first
'---------------------------------
For Each Sh In ActiveSheet.Shapes
Sh.Delete
Next

Set CBC = _
CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlButton, _
temporary:=True)

Do
If i Mod 12 = 0 Then
n = n + 1
c = 1
Else
c = c + 1
End If
i = i + 1
On Error GoTo ERROROUT
CBC.FaceId = i
On Error Resume Next
CBC.CopyFace
If Err.Number = 0 Then
Cells(n, c) = strSpacer & i
ActiveSheet.Paste Cells(n, c)
Else
Err.Clear
End If
Application.StatusBar = _
" Dumping all Office FaceID's in sheet, please wait ... " & i
Loop

ERROROUT:
CBC.Delete

With ActiveSheet.DrawingObjects
.ShapeRange.ScaleWidth 1.28, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight 1.28, msoFalse, msoScaleFromTopLeft
Range(Cells(1), Cells(n, 1)).RowHeight = .ShapeRange.Height
End With

Range(Cells(1), Cells(n, 12)).Columns.AutoFit

With Application
.ScreenUpdating = True
.Cursor = xlDefault
.StatusBar = False
End With

End Sub
'---------------------------------------------------------

Hope this helps
Rowan

PosseJohn wrote:
I am running a routine that adds face ID's to the toolbar, so that I can
'see' which one I would like to use in/for my apps. I am creating 2 toolbars
that contain 500 buttons each.

I change the .toolbartip to the face ID number, .onaction = xlnone.

Seems extreme, but it allows me to select the face ID's easily.

The .top and .left properties seem to be working, just the .height and
.width are not working at all.

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
positioning the control on a popup commandbar MVM Excel Programming 3 October 21st 05 07:28 PM
CommandBar swiederkehr Excel Programming 5 July 19th 05 04:58 PM
Positioning Roger[_20_] Excel Programming 4 July 8th 05 08:54 PM
= positioning snax500[_2_] Excel Programming 1 June 28th 04 08:24 PM
commandbar Greg Prost[_2_] Excel Programming 2 November 21st 03 11:42 AM


All times are GMT +1. The time now is 10:43 PM.

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"