Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Embed Pictures in Workbook

Was wondering if there was a way to do this????

This is what I have to display a selected picture in a UserForm:

Image1.Picture = LoadPicture("I:\2004 Yankees Schedule\Logos\" & _
Label1.Caption & ".jpg")

With the above, I can display the .jpg that's associated with the
caption in Label1. If Label1.Caption = "Oakland", it'll display
the oakland.jpg as the Image picture.

What I'd like to be able to do is have those .jpg's included in the
workbook and still be able to achieve the same functionality.
Not worried about the size of the workbook as all 30 jpg's
only add up to about 180 kB.

Any ideas??

Thanks,
John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Embed Pictures in Workbook

You might have a look at Stephen Bullen's site and see the code for the
pastepicture.zip file

http://www.bmsltd.ie/Excel/Default.htm

look all the way down under the VBA section. Here is the writeup. Sounds
like what you want to do - paste from the clipboard into an image control.

The userforms in Excel 97 are great, apart from one BIG letdown - you can't
put charts on them! A kludgy workaround has been to export the chart as a
gif or jpg, then load it into an Image control using LoadPicture. That
works ok-ish for charts, but it can't handle word art, shapes or other
pictures created on the fly. This file includes code to create a Picture
object from whatever is on the clipboard. Display a chart on a userform is
now as easy as a copy/paste. Thanks to VB MVPs Karl Peterson, Randy Birch
and Brad Martinez for their help. You can paste the image as either a
bitmap (better for same-size copies) or a metafile (better when
zooming/stretching), whichever best suits your circumstances. This update
includes an example of saving the picture to disk as a bitmap or metafile.

--
Regards,
Tom Ogilvy


"John Wilson" wrote in message
...
Was wondering if there was a way to do this????

This is what I have to display a selected picture in a UserForm:

Image1.Picture = LoadPicture("I:\2004 Yankees Schedule\Logos\" & _
Label1.Caption & ".jpg")

With the above, I can display the .jpg that's associated with the
caption in Label1. If Label1.Caption = "Oakland", it'll display
the oakland.jpg as the Image picture.

What I'd like to be able to do is have those .jpg's included in the
workbook and still be able to achieve the same functionality.
Not worried about the size of the workbook as all 30 jpg's
only add up to about 180 kB.

Any ideas??

Thanks,
John




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Embed Pictures in Workbook

Tom,

I tried Steve's file and still can't get this to work.
There is the distinct possibility that some of my synapses aren't
firing correctly.

Would've thought that it would be easier to link an Image control
to a picture saved directly in the workbook than it would be to link
to a picture somewhere on the hard drive but obviously, that isn't
the case. :-(

Forgetting the fact that I would want to change these pictures
programmatically, how would I link a single embedded picture
to an image control on a UserForm?

Example:
Took a small picture. Copied and pasted it from "Paint" to Sheet1
of a workbook. Excel named it "Object 1" and the formula bar
shows it as
=EMBED("Paint.Picture","")

How do I get that Picture, Object, OLEObject, whatever the heck it
is to display on Image1 in UserForm1???

Thanks,
John





"Tom Ogilvy" wrote in message
...
You might have a look at Stephen Bullen's site and see the code for the
pastepicture.zip file

http://www.bmsltd.ie/Excel/Default.htm

look all the way down under the VBA section. Here is the writeup. Sounds
like what you want to do - paste from the clipboard into an image control.

The userforms in Excel 97 are great, apart from one BIG letdown - you

can't
put charts on them! A kludgy workaround has been to export the chart as a
gif or jpg, then load it into an Image control using LoadPicture. That
works ok-ish for charts, but it can't handle word art, shapes or other
pictures created on the fly. This file includes code to create a Picture
object from whatever is on the clipboard. Display a chart on a userform

is
now as easy as a copy/paste. Thanks to VB MVPs Karl Peterson, Randy Birch
and Brad Martinez for their help. You can paste the image as either a
bitmap (better for same-size copies) or a metafile (better when
zooming/stretching), whichever best suits your circumstances. This update
includes an example of saving the picture to disk as a bitmap or metafile.

--
Regards,
Tom Ogilvy


"John Wilson" wrote in message
...
Was wondering if there was a way to do this????

This is what I have to display a selected picture in a UserForm:

Image1.Picture = LoadPicture("I:\2004 Yankees Schedule\Logos\" & _
Label1.Caption & ".jpg")

With the above, I can display the .jpg that's associated with the
caption in Label1. If Label1.Caption = "Oakland", it'll display
the oakland.jpg as the Image picture.

What I'd like to be able to do is have those .jpg's included in the
workbook and still be able to achieve the same functionality.
Not worried about the size of the workbook as all 30 jpg's
only add up to about 180 kB.

Any ideas??

Thanks,
John






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Embed Pictures in Workbook

Tom,

Reconnected a few (not all) of my synapses, cleansed them with
some alchohol (drinking, not rubbing) and got it to work using
Stephen's coding.

Thanks,
John

"John Wilson" wrote in message
...
Tom,

I tried Steve's file and still can't get this to work.
There is the distinct possibility that some of my synapses aren't
firing correctly.

Would've thought that it would be easier to link an Image control
to a picture saved directly in the workbook than it would be to link
to a picture somewhere on the hard drive but obviously, that isn't
the case. :-(

Forgetting the fact that I would want to change these pictures
programmatically, how would I link a single embedded picture
to an image control on a UserForm?

Example:
Took a small picture. Copied and pasted it from "Paint" to Sheet1
of a workbook. Excel named it "Object 1" and the formula bar
shows it as
=EMBED("Paint.Picture","")

How do I get that Picture, Object, OLEObject, whatever the heck it
is to display on Image1 in UserForm1???

Thanks,
John





"Tom Ogilvy" wrote in message
...
You might have a look at Stephen Bullen's site and see the code for the
pastepicture.zip file

http://www.bmsltd.ie/Excel/Default.htm

look all the way down under the VBA section. Here is the writeup.

Sounds
like what you want to do - paste from the clipboard into an image

control.

The userforms in Excel 97 are great, apart from one BIG letdown - you

can't
put charts on them! A kludgy workaround has been to export the chart as

a
gif or jpg, then load it into an Image control using LoadPicture. That
works ok-ish for charts, but it can't handle word art, shapes or other
pictures created on the fly. This file includes code to create a

Picture
object from whatever is on the clipboard. Display a chart on a userform

is
now as easy as a copy/paste. Thanks to VB MVPs Karl Peterson, Randy

Birch
and Brad Martinez for their help. You can paste the image as either a
bitmap (better for same-size copies) or a metafile (better when
zooming/stretching), whichever best suits your circumstances. This

update
includes an example of saving the picture to disk as a bitmap or

metafile.

--
Regards,
Tom Ogilvy


"John Wilson" wrote in message
...
Was wondering if there was a way to do this????

This is what I have to display a selected picture in a UserForm:

Image1.Picture = LoadPicture("I:\2004 Yankees Schedule\Logos\" & _
Label1.Caption & ".jpg")

With the above, I can display the .jpg that's associated with the
caption in Label1. If Label1.Caption = "Oakland", it'll display
the oakland.jpg as the Image picture.

What I'd like to be able to do is have those .jpg's included in the
workbook and still be able to achieve the same functionality.
Not worried about the size of the workbook as all 30 jpg's
only add up to about 180 kB.

Any ideas??

Thanks,
John








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
How do I embed pictures into a table that is sortable? unclesam Excel Discussion (Misc queries) 0 May 31st 07 01:40 PM
How do I embed a pictures to a excell spreadsheet cell db281961 New Users to Excel 1 January 12th 06 05:18 PM
Is it possible to embed pictures or graphics in Excel? msleah Excel Discussion (Misc queries) 1 December 20th 05 01:09 PM
Is it possible to embed pictures or graphics in Excel? msleah Excel Discussion (Misc queries) 1 December 20th 05 01:03 PM
how do I embed/Link pictures onto excel database cells? a0relento Excel Discussion (Misc queries) 0 October 14th 05 05:27 AM


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