Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Image Control Question

I have an image control on a Form and it's picture property is set
at design time.

This picture property is later changed by the command :

Form1.image1.Picture = Form2.Controls(k).Picture (k is set
appropriately).

What command sytax would be used to later restore Form1.image1.Picture
to it's design time default?

The Form is not closed whilst these images are changing, which may be
a solution, but preferably not if there's any alternative.

Thanks - Kirk

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Image Control Question

You'd need to store the original image so you can reset it.

I'd approach it like this, add an additional image control (ImgDefault) and
assign it's picture to that of your default image. Do NOT assign a picture
to your Image1 at design. In the form's initialize event do

Form1.image1.Picture = Form2.Controls("ImgDefault").Picture
Unload Form2 ' possibly ?

While your form is loaded, whenever you want to reapply the default image
run the above again (no doubt you can change "ImgDefault" to an index 'k').

Regards,
Peter T


"kirkm" wrote in message
...
I have an image control on a Form and it's picture property is set
at design time.

This picture property is later changed by the command :

Form1.image1.Picture = Form2.Controls(k).Picture (k is set
appropriately).

What command sytax would be used to later restore Form1.image1.Picture
to it's design time default?

The Form is not closed whilst these images are changing, which may be
a solution, but preferably not if there's any alternative.

Thanks - Kirk



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Image Control Question

Put this statement in the (General)(Declarations) section of the UserForm's
code window...

Dim OriginalPicture As StdPicture

Then put this in the UserForm's Initialize event...

Set OriginalPicture = Image1.Picture

Now, whenever and wherever you want to restore the original picture for the
Image1 control, just execute this statement...

Set Image1.Picture = OriginalPicture

--
Rick (MVP - Excel)


"kirkm" wrote in message
...
I have an image control on a Form and it's picture property is set
at design time.

This picture property is later changed by the command :

Form1.image1.Picture = Form2.Controls(k).Picture (k is set
appropriately).

What command sytax would be used to later restore Form1.image1.Picture
to it's design time default?

The Form is not closed whilst these images are changing, which may be
a solution, but preferably not if there's any alternative.

Thanks - Kirk


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Image Control Question

On Mon, 22 Sep 2008 10:45:55 -0400, "Rick Rothstein"
wrote:

Put this statement in the (General)(Declarations) section of the UserForm's
code window...

Dim OriginalPicture As StdPicture

Then put this in the UserForm's Initialize event...

Set OriginalPicture = Image1.Picture

Now, whenever and wherever you want to restore the original picture for the
Image1 control, just execute this statement...

Set Image1.Picture = OriginalPicture


Thanks Guys, I've spent quite a long time trying to achieve this and
have concluded it's just not worth it ! The 'Set" command seems to
cause Excel to crash with that 'Sorry for the inconvieniance' thing.
Then it spends hours recovering....

The simplist fix is not have any default image and create the required
one each time. Problem gone.

My original theory seemed Ok: if the image exists, use it
otherwise use the default - but too much hassle !

Thanks for the suggestions and help though.
Cheers - Kirk
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Image Control Question

Just so you are aware, I tested the code before I posted it and it worked
fine here on my XL2003 system. If you are getting a crash, then something
other than the Set statement is causing it.

--
Rick (MVP - Excel)


"kirkm" wrote in message
...
On Mon, 22 Sep 2008 10:45:55 -0400, "Rick Rothstein"
wrote:

Put this statement in the (General)(Declarations) section of the
UserForm's
code window...

Dim OriginalPicture As StdPicture

Then put this in the UserForm's Initialize event...

Set OriginalPicture = Image1.Picture

Now, whenever and wherever you want to restore the original picture for
the
Image1 control, just execute this statement...

Set Image1.Picture = OriginalPicture


Thanks Guys, I've spent quite a long time trying to achieve this and
have concluded it's just not worth it ! The 'Set" command seems to
cause Excel to crash with that 'Sorry for the inconvieniance' thing.
Then it spends hours recovering....

The simplist fix is not have any default image and create the required
one each time. Problem gone.

My original theory seemed Ok: if the image exists, use it
otherwise use the default - but too much hassle !

Thanks for the suggestions and help though.
Cheers - Kirk




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Image Control Question

On Tue, 23 Sep 2008 01:19:25 -0400, "Rick Rothstein"
wrote:

Just so you are aware, I tested the code before I posted it and it worked
fine here on my XL2003 system. If you are getting a crash, then something
other than the Set statement is causing it.


Sorry Rick, I never meant there was anything wrong with your code, it
was just threading it in with what's here.... I'm a learner and what
I'm doing is really way too ambitious. A million things could upset it
- BUT it's stable and working at the moment :)
Thanks agan for the help.... what I've got from this group is
invaluable.

Cheers - Kirk
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
frame control inside an image control moniong Excel Programming 2 March 30th 07 03:29 AM
Programatically control picture property of Image control Brassman[_5_] Excel Programming 5 May 24th 05 09:32 PM
Image control ojv[_2_] Excel Programming 2 October 13th 04 12:33 PM
Displaying a Tif image in the Image Control Neil Excel Programming 1 September 21st 04 12:56 AM
copy shape image into image control Luc Benninger Excel Programming 2 July 15th 04 11:14 AM


All times are GMT +1. The time now is 03:26 PM.

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"