Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LoadPicture for a ControlButton help


Hello,

I am writing a custom toolbar and I wish to assigne a picture to one of
the control button but my syntax doesn't work. It bugs on .Picture=

Could someone help ?


Set cb = Application.CommandBars.Add(Name:="ToolBar1", temporary:=True)


With cb
Set cbpop = .Controls.Add(Type:=msoControlButton, temporary:=True)
With cbpop
..Picture = LoadPicture("C:\STOCK
CONTROL\Data-Macro\ArrRedLeftPlain.bmp")
..OnAction = ThisWorkbook.Name & "!Macro_Vide"
End With
End With

Cheers
Francois


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default LoadPicture for a ControlButton help

What version of excel. I believe this is only supported in xl2003 (perhas
2002).

--
Regards,
Tom Ogilvy


"micmacuk" wrote:


Hello,

I am writing a custom toolbar and I wish to assigne a picture to one of
the control button but my syntax doesn't work. It bugs on .Picture=

Could someone help ?


Set cb = Application.CommandBars.Add(Name:="ToolBar1", temporary:=True)


With cb
Set cbpop = .Controls.Add(Type:=msoControlButton, temporary:=True)
With cbpop
.Picture = LoadPicture("C:\STOCK
CONTROL\Data-Macro\ArrRedLeftPlain.bmp")
.OnAction = ThisWorkbook.Name & "!Macro_Vide"
End With
End With

Cheers
Francois


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LoadPicture for a ControlButton help


Thanks Tom,

Am using Office 2000....so bad luck for me



Tom Ogilvy Wrote:
What version of excel. I believe this is only supported in xl2003
(perhas
2002).

--
Regards,
Tom Ogilvy


"micmacuk" wrote:


Hello,

I am writing a custom toolbar and I wish to assigne a picture to one

of
the control button but my syntax doesn't work. It bugs on .Picture=

Could someone help ?


Set cb = Application.CommandBars.Add(Name:="ToolBar1",

temporary:=True)


With cb
Set cbpop = .Controls.Add(Type:=msoControlButton, temporary:=True)
With cbpop
.Picture = LoadPicture("C:\STOCK
CONTROL\Data-Macro\ArrRedLeftPlain.bmp")
.OnAction = ThisWorkbook.Name & "!Macro_Vide"
End With
End With

Cheers
Francois


--
micmacuk

------------------------------------------------------------------------
micmacuk's Profile:

http://www.excelforum.com/member.php...o&userid=33253
View this thread:

http://www.excelforum.com/showthread...hreadid=546771




--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LoadPicture for a ControlButton help


May be I could turn around this by creating a custom hiden toolbar with
my custom buttom and copy them in the toolbar I want to use...
But if so how could I copy those buttons in VBA ??


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default LoadPicture for a ControlButton help

In xl2000 you would copy the picture to the clipboard and then use pasteface
- so you migt have to import it into the worksheet first.

--
Regards,
Tom Ogilvy


"micmacuk" wrote:


Thanks Tom,

Am using Office 2000....so bad luck for me



Tom Ogilvy Wrote:
What version of excel. I believe this is only supported in xl2003
(perhas
2002).

--
Regards,
Tom Ogilvy


"micmacuk" wrote:


Hello,

I am writing a custom toolbar and I wish to assigne a picture to one

of
the control button but my syntax doesn't work. It bugs on .Picture=

Could someone help ?


Set cb = Application.CommandBars.Add(Name:="ToolBar1",

temporary:=True)


With cb
Set cbpop = .Controls.Add(Type:=msoControlButton, temporary:=True)
With cbpop
.Picture = LoadPicture("C:\STOCK
CONTROL\Data-Macro\ArrRedLeftPlain.bmp")
.OnAction = ThisWorkbook.Name & "!Macro_Vide"
End With
End With

Cheers
Francois


--
micmacuk

------------------------------------------------------------------------
micmacuk's Profile:

http://www.excelforum.com/member.php...o&userid=33253
View this thread:

http://www.excelforum.com/showthread...hreadid=546771




--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default LoadPicture for a ControlButton help

Import into the worksheet, then copy it to the clipboard and use pasteface.

--
Regards,
Tom Ogilvy


"micmacuk" wrote:


May be I could turn around this by creating a custom hiden toolbar with
my custom buttom and copy them in the toolbar I want to use...
But if so how could I copy those buttons in VBA ??


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default LoadPicture for a ControlButton help


Thanks Tom it works...
How can I give a "name" to the "shape" picture.

I have paste my icon pic. on my data sheet and I have used the macro
recorder to get the name of the pic. and was surprise to see the name
("Picture 4") although it is the only pic on this sheet.

Also is there a way to copy the pic frpm the disk and paste it onto my
data sheet (and then give it a name...) ?


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default LoadPicture for a ControlButton help

turn on the macro recorder while you do

Insert=Picture from File

I get
ActiveSheet.Pictures.Insert( _
"C:\Documents and Settings\OgilvyTW\My Documents\My
Pictures\Part1.jpg").Select

so to use that, some modifications:

Dim Pic as Picture
Dim sName as String
sName = "C:\Myfiles\MyPictures\House.jpg"
set pic = Activesheet.Pictures.Insert(sName)
Pic.Name = "doghouse"

--
Regards,
Tom Ogilvy

"micmacuk" wrote:


Thanks Tom it works...
How can I give a "name" to the "shape" picture.

I have paste my icon pic. on my data sheet and I have used the macro
recorder to get the name of the pic. and was surprise to see the name
("Picture 4") although it is the only pic on this sheet.

Also is there a way to copy the pic frpm the disk and paste it onto my
data sheet (and then give it a name...) ?


--
micmacuk
------------------------------------------------------------------------
micmacuk's Profile: http://www.excelforum.com/member.php...o&userid=33253
View this thread: http://www.excelforum.com/showthread...hreadid=546771


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
conditional compile for LoadPicture? RB Smissaert Excel Programming 2 March 27th 06 04:37 PM
LoadPicture - how to keep .jpg compression No Name Excel Programming 0 May 25th 04 08:14 AM
re ControlButton numbers , Id:=??? mcpheat Excel Programming 0 July 20th 03 12:52 PM
LoadPicture Pathname or no Pathname Philipp Schramek Excel Programming 1 July 8th 03 03:30 PM


All times are GMT +1. The time now is 09:59 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"