Thread
:
Toolbar should not be on its own row!
View Single Post
#
2
Posted to microsoft.public.excel.programming
Gary L Brown
external usenet poster
Posts: 219
Toolbar should not be on its own row!
This is untested but I think will work.
First, we need to find out some information about the Drawing toolbar -
where it's left edge is, how wide it is, what row position it is at. Then,
we can place your toolbar next to it.
Step 1) Declare some variables. This coding goes right after the Procedure
name "Sub CreateAToolbar()"...
Dim iLeft As Integer 'left edge of Drawing Toolbar
Dim iWidth As Integer 'width of Drawing Toolbar
Dim iRowIndex As Integer 'Row # of Drawing Toolbar
Step 2) Check if the Drawing Toolbar is visible. This coding goes right
after the variables in step 1. If it is, get the information needed...
If CommandBars("Drawing").Visible = True Then
With CommandBars("Drawing")
iLeft = .Left 'left edge of Drawing Toolbar
iWidth = .Width 'width of Drawing Toolbar
iRowIndex = .RowIndex 'Row # of Drawing Toolbar
End With
End If
Step 3) Place your toolbar to the right of the Drawing toolbar if the
Drawing toolbar is visible. This coding goes right after the ".Visible =
True" line near the end of your procedure...
If CommandBars("Drawing").Visible = True Then
.Left = iLeft + iWidth 'Right edge of Drawing Toolbar...refering
to tBarName
.RowIndex = iRowIndex 'Same row as Drawing Toolbar...refering to
tBarName
End If
HTH,
--
Gary Brown
If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.
"Craigm" wrote:
I create a toolbar that has three icons with the code below. When I
open the worksheet it appears at the bottom of the sheet on its own row
below the drawing tolbar.
Is it possible to have this toolbar open beside the drawing toolbar?
There is plenty of room and would give me a larger worksheet viewing
area.
Thanks,
Craig
Sub CreateAToolbar()
Const tBarName As String = "Service Maintenance"
'Delete CommandBar if it exists
On Error Resume Next
CommandBars(tBarName).Delete
On Error GoTo 0
'create CommandBar
CommandBars.Add Name:=tBarName
'define an object variable to refer to the CommandBar
With CommandBars(tBarName)
'add button use 1 to specify a blank custom face
With .Controls.Add(ID:=1)
.OnAction = "Inven1Import"
.FaceId = 9946
.Caption = "Inventory Import"
End With
With .Controls.Add(ID:=1)
.OnAction = "Mile1Import"
.FaceId = 9942
.Caption = "Mileage Import"
End With
With .Controls.Add(ID:=1)
.OnAction = "Master_Control"
.FaceId = 1763
.Caption = "Master Control"
.BeginGroup = True 'this adds the separator
bar
End With
'.Position = msoBarTop
.Position = msoBarBottom
.Visible = True 'display the toolbar
End With
End Sub
--
Craigm
------------------------------------------------------------------------
Craigm's Profile:
http://www.excelforum.com/member.php...o&userid=24381
View this thread:
http://www.excelforum.com/showthread...hreadid=499513
Reply With Quote
Gary L Brown
View Public Profile
Find all posts by Gary L Brown