Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Very basic question, please


This must be blindingly easy, but I can't figure it.

The working example is -

frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture

However, the 'imgDecca' bit is a variable string. So how do you
properly code the equivalent of this -

frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture

I've tried everything I can think of ! Brackets, CStr... you name it.
They all fail.

Thanks for any help.

Cheers - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Very basic question, please

Hi!

frmSerial.imgLabelA.Picture =LoadPicture(imgDecca)

imgDecca must be a full fille name string (path and fillename) of the picture.

John

Ο χρήστης "kirkm" *γγραψε:


This must be blindingly easy, but I can't figure it.

The working example is -

frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture

However, the 'imgDecca' bit is a variable string. So how do you
properly code the equivalent of this -

frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture

I've tried everything I can think of ! Brackets, CStr... you name it.
They all fail.

Thanks for any help.

Cheers - Kirk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Very basic question, please

I don't know what references/objectmodel you are using, but perhaps:
imgDecca
is an Object of some kind, then:

Dim MyImage as Object ' or whatever is appropriate
..
..
..
Set MyImage=imgDecca
frmSerial.imgLabelA.Picture = frmLabelIcons.MyImage.Picture

You would then vary the Set to pick up the proper picture
--
Gary''s Student - gsnu2007k


"kirkm" wrote:


This must be blindingly easy, but I can't figure it.

The working example is -

frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture

However, the 'imgDecca' bit is a variable string. So how do you
properly code the equivalent of this -

frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture

I've tried everything I can think of ! Brackets, CStr... you name it.
They all fail.

Thanks for any help.

Cheers - Kirk

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Very basic question, please

I think you are looking for this...

frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture

--
Rick (MVP - Excel)


"kirkm" wrote in message
...

This must be blindingly easy, but I can't figure it.

The working example is -

frmSerial.imgLabelA.Picture = frmLabelIcons.imgDecca.Picture

However, the 'imgDecca' bit is a variable string. So how do you
properly code the equivalent of this -

frmSerial.imgLabelA.Picture = frmLabelIcons. & "imgDecca" & .Picture

I've tried everything I can think of ! Brackets, CStr... you name it.
They all fail.

Thanks for any help.

Cheers - Kirk


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Very basic question, please

On Fri, 12 Sep 2008 09:59:34 -0400, "Rick Rothstein"
wrote:

I think you are looking for this...

frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture


You guys are brilliant, thanks very much.

All going wonderfully, and I've learnt a few things.

Many thanks - Kirk


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Very basic question, please


I think you are looking for this...

frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture


Rick, one last request :)

What if the required image for frmSerial.imgLabelA.Picture is the
default? The one that's embedded in the Form - and shows if the above
line is not executed?

I've found calling it what it's been changed to, and now is, doesn't
really work ROFL...

Thanks - Kirk
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Very basic question, please

I think you are looking for this...

frmSerial.imgLabelA.Picture = frmLabelIcons.Controls("imgDecca").Picture


Rick, one last request :)

What if the required image for frmSerial.imgLabelA.Picture is the
default? The one that's embedded in the Form - and shows if the above
line is not executed?

I've found calling it what it's been changed to, and now is, doesn't
really work ROFL...


I'm not exactly sure what you mean when you say "calling it what it's been
changed to". As for what I think you might be describing, all I can say is
it works for me. To recap... I assigned a picture to imgLabelA via the
Properties Window, ran the UserForm it is located on and executed the line
of code I posted (from a CommandButton on the UserForm)... the pre-assigned
picture from the Properties Window was replaced by the picture from imgDecca
on the other UserForm.

--
Rick (MVP - Excel)

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Very basic question, please

On Fri, 12 Sep 2008 13:07:17 -0400, "Rick Rothstein"
wrote:


I'm not exactly sure what you mean when you say "calling it what it's been
changed to". As for what I think you might be describing, all I can say is
it works for me. To recap... I assigned a picture to imgLabelA via the
Properties Window, ran the UserForm it is located on and executed the line
of code I posted (from a CommandButton on the UserForm)... the pre-assigned
picture from the Properties Window was replaced by the picture from imgDecca
on the other UserForm.


Hi Rick, Yes indeed, it works the same here too. But my logic is, if
the required label image doesn't exist it uses a default one. The way
I've coded it, the Form doesn't (have to) close and the last label it
loaded remains the active one. I could just copy it again but as it's
already there, why not use it? Trouble is, it's just called (Bitmap)
in properties and I don't know how to access it (apart from Close/Open
the form).

Thanks - Kirk
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Very basic question, please

Maybe I still am not following what you are trying to say, but you can
always reference an Image control's Picture property no matter how that
picture was loaded... if it was assigned from a file at design time, your
code can still get the picture by assigning its Picture property to whatever
other Image control you have (this can be done in the Workbook's Open event
if you need it before your code runs).

--
Rick (MVP - Excel)


"kirkm" wrote in message
...
On Fri, 12 Sep 2008 13:07:17 -0400, "Rick Rothstein"
wrote:


I'm not exactly sure what you mean when you say "calling it what it's been
changed to". As for what I think you might be describing, all I can say is
it works for me. To recap... I assigned a picture to imgLabelA via the
Properties Window, ran the UserForm it is located on and executed the line
of code I posted (from a CommandButton on the UserForm)... the
pre-assigned
picture from the Properties Window was replaced by the picture from
imgDecca
on the other UserForm.


Hi Rick, Yes indeed, it works the same here too. But my logic is, if
the required label image doesn't exist it uses a default one. The way
I've coded it, the Form doesn't (have to) close and the last label it
loaded remains the active one. I could just copy it again but as it's
already there, why not use it? Trouble is, it's just called (Bitmap)
in properties and I don't know how to access it (apart from Close/Open
the form).

Thanks - 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
Very basic VBA question. Cerberus Excel Discussion (Misc queries) 1 July 21st 08 04:30 PM
basic question M121385 New Users to Excel 4 May 6th 08 06:22 PM
Basic VBA Question amirstal Excel Programming 2 December 20th 06 02:39 PM
Basic VBA Question amirstal Excel Programming 5 December 18th 06 05:09 PM
Basic VBA question... mattsvai[_7_] Excel Programming 8 February 3rd 06 07:53 PM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"