I designed a custom toolbar and image of msocontrolbutton is coming using .PasteFace method. Size of image is very very small in toolbar. How to increase size and brightness of image in custom toolbar of Excel 2000?
Set cbImage = cbImgBar.Controls.Add(Type:=msoControlButton)
With cbImage
'.FaceId = 198
.Caption = "TheMarketsImage"
.Style = msoButtonIcon
.Width = 120
.Height = 100
.PasteFace
End With
2006-08-06
19:54:02
·
0 answers
·
asked by
padam_india
1
in
Computers & Internet
➔ Programming & Design
Anybody can help me?
2006-08-07
19:02:07 ·
update #1
I am working on automation of excel sheet and have designed a custom toolbar using VBA for Excel 2000 (or later version). When runtime i read path of image and display in custom toolbar of excel 2000 then size of image appears very small in fact it is 16X16 as per excel policy.
This image is a company logo so i can not reduce size of it and have to display little bit larger i.e. 30X90. Can you help me with VBA code? I have to do this setup with help of VBA code only.
2006-08-08
03:27:33 ·
update #2
My code:
Dim cbImgBar As CommandBar
Set cbImgBar = CommandBars.Add(Name:=cImgCommandBarID, Position:=msoBarTop)
Dim cbImage As CommandBarControl
Dim imgTool As Shape
Dim sFileName, ImgSheet
sFileName = ActiveWorkbook.Path & "\Images\ABC.jpg"
' hide appearance of picture from the user
Application.ScreenUpdating = False
' insert picture from file and copy inserted picture
ActiveSheet.Pictures.Insert(sFileName).CopyPicture Appearance:=xlScreen, Format:= xlBitmap
Set cbImage = cbImgBar.Controls.Add(Type:=msoControlButton)
With cbImage
.Caption = ""
.Style = msoButtonIcon
.Width = 120
.Height = 1
.PasteFace
End With
' remove the inserted picture
ActiveSheet.Pictures(ActiveSheet.Pictures.Count).Delete
Application.ScreenUpdating = True
2006-08-08
03:29:10 ·
update #3