P
Padam
I have created custom toolbar but image's size in custom toolbar using
msoControlButton is very small and blurred using below code. How I can
increase / decrease size of image as well as brightness of image in custom
toolbar?
It would be great help for me, if you can.
My code:
'========================================
Const cImgCommandBarID As String = "TMC Img Toolbar"
'Image code
Dim cbImgBar As CommandBar
Set cbImgBar = CommandBars.Add(Name:=cImgCommandBarID,
Position:=msoBarTop)
'cbImgBar.context = 1000
Dim cbImage As CommandBarControl
Dim imgTool As Shape
Dim sFileName, ImgSheet
sFileName = ActiveWorkbook.Path & "\Images\ABC.jpg"
Const sNAME = "MyToolFace"
'================
' 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
'.FaceId = 198
.Caption = "TheMarketsImage"
.Style = msoButtonIcon
.Width = 120
.Height = 100
.PasteFace
End With
' remove the inserted picture
ActiveSheet.Pictures(ActiveSheet.Pictures.Count).Delete
Application.ScreenUpdating = True
msoControlButton is very small and blurred using below code. How I can
increase / decrease size of image as well as brightness of image in custom
toolbar?
It would be great help for me, if you can.
My code:
'========================================
Const cImgCommandBarID As String = "TMC Img Toolbar"
'Image code
Dim cbImgBar As CommandBar
Set cbImgBar = CommandBars.Add(Name:=cImgCommandBarID,
Position:=msoBarTop)
'cbImgBar.context = 1000
Dim cbImage As CommandBarControl
Dim imgTool As Shape
Dim sFileName, ImgSheet
sFileName = ActiveWorkbook.Path & "\Images\ABC.jpg"
Const sNAME = "MyToolFace"
'================
' 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
'.FaceId = 198
.Caption = "TheMarketsImage"
.Style = msoButtonIcon
.Width = 120
.Height = 100
.PasteFace
End With
' remove the inserted picture
ActiveSheet.Pictures(ActiveSheet.Pictures.Count).Delete
Application.ScreenUpdating = True