Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Load image from directory for custom toolbar of Excel 2000

Below code gives error as cb.Picture = picPicture does not exists. Kindly
help me. I am using it for Excel 2000 VBA.

Private Sub Workbook_Activate()
'sImageFile = ThisWorkbook.Path & "\ABC.jpg"
Dim c As CommandBar
Dim cb As CommandBarButton
Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp 'you can also change the mask
Set picPicture = stdole.StdFunctions.LoadPicture(ThisWorkbook.Path &
"\ABC.jpg")

'optional - only of you have a mask file
'Set picMask = stdole.StdFunctions.LoadPicture("c:\...(your
path)...\maskName.bmp")
On Error Resume Next
Application.CommandBars("BarName").Delete

Set c = Application.CommandBars.Add("BarName", msoBarFloating, False,
True)
c.Enabled = True
c.Visible = True

Set cb = c.Controls.Add(msoControlButton)
cb.Style = msoButtonIcon
cb.Tag = "ButtonTest"

'Set the picture
cb.Picture = picPicture
'Set the mask
'cb.Mask = picMask
cb.OnAction = "ThisWorkbook.Test"
Set cb = Nothing
Set c = Nothing

End Sub




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
problem with opening hyperlink in excel 2000 Ruth Links and Linking in Excel 5 March 15th 06 06:06 PM
how do I run excel 4.0 macros on excel 2000 RodolfoDallas Excel Discussion (Misc queries) 1 March 12th 06 03:14 AM
Excel 2003 crashes loading excel files created Excel 2000 Jeff Lewin Australia Excel Discussion (Misc queries) 0 June 27th 05 04:20 AM
other systems detecting excel 4.0 if excel 2000 is installed Tristan_Flynn Setting up and Configuration of Excel 0 January 18th 05 06:55 PM
pivotcell object to excel 2000 Kellyc Excel Discussion (Misc queries) 0 December 1st 04 03:45 PM


All times are GMT +1. The time now is 09:20 AM.

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"