ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Displaying an image without using external files (https://www.excelbanter.com/excel-programming/316799-displaying-image-without-using-external-files.html)

d.i.barr[_2_]

Displaying an image without using external files
 

I am sure there must be a way to solve this because I have seen example
close to what I want but not quite, but my attempts so far have failed.
I would like a user form to display an image that will not be stored o
others' computers.

Ideally I would like the image to display an embedded object but not b
reference of object number or name because it will change regularl
depending on user clicks in a list box (user clicks on the desire
object in the list box, code searches for the entry on the spread shee
and displays the relevant picture which is in a column). If possible,
want to display it by whats in the cell.

I know it is possible to enter a formula in a picture formula box t
display what is in or "over" that cell, but there seems to be no way t
do it for the image box in a form (although it may be something a
simple as a syntax error, I've not been coding that long).

If this isn't possible, I will settle for the syntax to refer to a
embedded image although the resulting code may get a bit spagetti, an
of course it's good practice not to hard code absolute values.

Thanks in advance,
David Bar

--
d.i.bar
-----------------------------------------------------------------------
d.i.barr's Profile: http://www.excelforum.com/member.php...fo&userid=1552
View this thread: http://www.excelforum.com/showthread.php?threadid=27824


s_u_resh[_9_]

Displaying an image without using external files
 

hi,

I understand you like to show some of catalog display.

You can have many forms. You can call one form at a time.

Regards
S.Sures

--
s_u_res
-----------------------------------------------------------------------
s_u_resh's Profile: http://www.excelforum.com/member.php...fo&userid=1567
View this thread: http://www.excelforum.com/showthread.php?threadid=27824


keepITcool

Displaying an image without using external files
 

I've simulated your combobox with a validation list..
sourced by a list of filenames in ColumnD


you'll need an Embedded Image control
from the control toolbox toolbar.

Make sure it's named "Image1"
Then run ReadFileName for the setup.

Now when cell a1 is changed the picture will follow.



Public Sub ReadFileNames()
Dim sDir$, r&

Range("D:D").Clear
'msoDialogFolderPicker only exist in OFFICE 2000+
If Application.FileDialog(msoFileDialogFolderPicker). Show = False Then
Exit Sub
sDir = Dir("*.jpg")
While sDir < vbNullString
r = r + 1
Range("D" & r) = CurDir & Application.PathSeparator & sDir
sDir = Dir()
Wend
If r 0 Then
Application.EnableEvents = False
With Range("a1")
.ClearContents

.Interior.ColorIndex = 37

.Validation.Delete
.Value = "[Select your picture]"

.Validation.Add xlValidateList, Formula1:="=$D$1:$D$" & r
End With
Application.EnableEvents = True
End If

End Sub



Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$A$1" Then
Image1.Picture = LoadPicture(Range("a1"))
End If
End Sub








--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam

d.i.barr wrote in message
:


I am sure there must be a way to solve this because I have seen

examples
close to what I want but not quite, but my attempts so far have

failed.
I would like a user form to display an image that will not be stored

on
others' computers.

Ideally I would like the image to display an embedded object but not

by
reference of object number or name because it will change regularly
depending on user clicks in a list box (user clicks on the desired
object in the list box, code searches for the entry on the spread

sheet
and displays the relevant picture which is in a column). If possible,

I
want to display it by whats in the cell.

I know it is possible to enter a formula in a picture formula box to
display what is in or "over" that cell, but there seems to be no way

to
do it for the image box in a form (although it may be something as
simple as a syntax error, I've not been coding that long).

If this isn't possible, I will settle for the syntax to refer to an
embedded image although the resulting code may get a bit spagetti, and
of course it's good practice not to hard code absolute values.

Thanks in advance,
David Barr





All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com