PC Review


Reply
Thread Tools Rate Thread

change image in picture object

 
 
Sister Ray
Guest
Posts: n/a
 
      17th Mar 2009
how does one change the image shown in a picture object, without
removing the picture object and adding it again?

Best regards,
Carlos Pedro
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      17th Mar 2009
On a worksheet???

Did you use Insert|Picture to insert the picture or did you insert an image
control (from the control toolbox toolbar) and then insert a picture into that.

If you used Insert|Picture, I don't think you can change it--just delete and
add.

If you used the image control, then you could go into design mode, show the
properties and change the properties.

or in code...

Worksheets("Sheet1").OLEObjects("Image1").Object.Picture _
= LoadPicture("C:\My Pictures\01.jpg")

You'll need a reference to OLE Automation (under Tools|references in the VBE).

===
the same kind of thing (loadpicture) in an image control on a userform.


Sister Ray wrote:
>
> how does one change the image shown in a picture object, without
> removing the picture object and adding it again?
>
> Best regards,
> Carlos Pedro


--

Dave Peterson
 
Reply With Quote
 
Sister Ray
Guest
Posts: n/a
 
      17th Mar 2009
On 17 mar, 16:06, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> On a worksheet???
>

Yes, I got the pictures collection from a worksheet and added a
picture to it, using the insert method exposed by the pictures object.

> Did you use Insert|Picture to insert the picture or did you insert an image
> control (from the control toolbox toolbar) and then insert a picture intothat.
>

It was a picture, not an image control.

> If you used Insert|Picture, I don't think you can change it--just delete and
> add.
>


However since I'm using the index property of the Picture object
"know" which image I'm accessing if I remove an image and add a new
one to replace it the indexes will have changed.

> If you used the image control, then you could go into design mode, show the
> properties and change the properties.
>
> or in code...
>
> * Worksheets("Sheet1").OLEObjects("Image1").Object.Picture _
> * * * * * * = LoadPicture("C:\My Pictures\01.jpg")
>


Image Control? How is this exposed by the Excel COM?

> You'll need a reference to OLE Automation (under Tools|references in the VBE).
>

I'm automating excel using C++ and the Excel COM, all the help I've
found so far has been the VBA reference, VBA foruns and 3 msdn pages
that talk about MFC/C++ Office Automation. Is there a news group
dedicated do MFC/C++ Office automation? There must be a reazonable
amout of people automating excel this way, and hopefully they will be
helpful.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      17th Mar 2009
I don't speak the COM.

Maybe someone can jump in.

Sister Ray wrote:
>
> On 17 mar, 16:06, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > On a worksheet???
> >

> Yes, I got the pictures collection from a worksheet and added a
> picture to it, using the insert method exposed by the pictures object.
>
> > Did you use Insert|Picture to insert the picture or did you insert an image
> > control (from the control toolbox toolbar) and then insert a picture into that.
> >

> It was a picture, not an image control.
>
> > If you used Insert|Picture, I don't think you can change it--just delete and
> > add.
> >

>
> However since I'm using the index property of the Picture object
> "know" which image I'm accessing if I remove an image and add a new
> one to replace it the indexes will have changed.
>
> > If you used the image control, then you could go into design mode, show the
> > properties and change the properties.
> >
> > or in code...
> >
> > Worksheets("Sheet1").OLEObjects("Image1").Object.Picture _
> > = LoadPicture("C:\My Pictures\01.jpg")
> >

>
> Image Control? How is this exposed by the Excel COM?
>
> > You'll need a reference to OLE Automation (under Tools|references in the VBE).
> >

> I'm automating excel using C++ and the Excel COM, all the help I've
> found so far has been the VBA reference, VBA foruns and 3 msdn pages
> that talk about MFC/C++ Office Automation. Is there a news group
> dedicated do MFC/C++ Office automation? There must be a reazonable
> amout of people automating excel this way, and hopefully they will be
> helpful.


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select certain parts of an object, picture, image to grow Evad Microsoft Powerpoint 0 7th Jan 2009 12:03 AM
Picture/Image Object Array Placement Paul Engel Microsoft Dot NET Framework Forms 0 25th Jul 2008 09:35 PM
keydown and picture image change problem oldsap Microsoft Dot NET Compact Framework 0 13th Nov 2007 04:56 AM
Click on picture to change image =?Utf-8?B?YW5keTExOGdv?= Microsoft Frontpage 5 12th Feb 2005 12:54 AM
How can I change the picture of an unbound object frame? =?Utf-8?B?U3RldmVD?= Microsoft Access Forms 0 28th Jan 2005 03:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:19 AM.