p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Databases (http://p2p.wrox.com/forumdisplay.php?f=62)
-   -   Increase size of image in button of Excel Toolbar (http://p2p.wrox.com/showthread.php?t=46435)

padam August 11th, 2006 02:03 PM

Increase size of image in button of Excel Toolbar
 
Excel 2000 version only
=======================
Image size appears in button(msocontrolbutton) of custom toolbar Excel 2000 is very small and blurred using below code. How I can increase size of image in button (msocontrolbutton) as well as brightness of image in custom toolbar?

I am able to increase size of button using width and height property but image appears in center of button as 16X16. How to fit image to button(msocontrolbutton)?

It would be really great help for me……

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).D elete

    Application.ScreenUpdating = True




All times are GMT -4. The time now is 03:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.