Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
conditional compile for LoadPicture? | Excel Programming | |||
LoadPicture - how to keep .jpg compression | Excel Programming | |||
re ControlButton numbers , Id:=??? | Excel Programming | |||
LoadPicture Pathname or no Pathname | Excel Programming |