How to insert picture based on numeric value in another cell?

J

James Norton

Hi there,

I am trying to figure out how I can insert a picture (jpg) based on a number
in another box.

I have a database of over 1500 pictures at a pharmacy of the different meds.
The file name is always a DIN number and is unique to that medication (i.e.
0982_567252567.jpg). I don't know what the first 4 digits and underscore are
for and I would like to be able to ignore that.

So if I enter drug number 567252567 in box A1 - it will look for that string
(567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg) into A2.

The good thing is that the number regardless of what is in front of it will
be unique.

The point of doing this is that we print out drug information for seniors.
When we type in the DIN number it will insert a picture of the pill they
need to take preventing medication errors.

Any help is most appreciated as always,

Best regards,

James Norton
 
W

William

Hi James

Try this code

Sub test()
Dim s As String, i As Integer
s = "c:\pics"
ActiveSheet.Range("A2").Select
With Application.FileSearch
..NewSearch
..LookIn = s
..SearchSubFolders = False
..Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
..MatchTextExactly = True
..Execute
For i = 1 To .FoundFiles.Count
ActiveSheet.DrawingObjects.Delete
ActiveSheet.Pictures.Insert (.FoundFiles(i))
Exit For
Next i
End With
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| Hi there,
|
| I am trying to figure out how I can insert a picture (jpg) based on a
number
| in another box.
|
| I have a database of over 1500 pictures at a pharmacy of the different
meds.
| The file name is always a DIN number and is unique to that medication
(i.e.
| 0982_567252567.jpg). I don't know what the first 4 digits and underscore
are
| for and I would like to be able to ignore that.
|
| So if I enter drug number 567252567 in box A1 - it will look for that
string
| (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg) into A2.
|
| The good thing is that the number regardless of what is in front of it
will
| be unique.
|
| The point of doing this is that we print out drug information for seniors.
| When we type in the DIN number it will insert a picture of the pill they
| need to take preventing medication errors.
|
| Any help is most appreciated as always,
|
| Best regards,
|
| James Norton
|
|
 
W

William

Hi James

Try this code

Sub test()
Dim s As String, i As Integer
s = "c:\pics"
ActiveSheet.Range("A2").Select
With Application.FileSearch
..NewSearch
..LookIn = s
..SearchSubFolders = False
..Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
..MatchTextExactly = True
..Execute
For i = 1 To .FoundFiles.Count
ActiveSheet.DrawingObjects.Delete
ActiveSheet.Pictures.Insert (.FoundFiles(i))
Exit For
Next i
End With
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| Hi there,
|
| I am trying to figure out how I can insert a picture (jpg) based on a
number
| in another box.
|
| I have a database of over 1500 pictures at a pharmacy of the different
meds.
| The file name is always a DIN number and is unique to that medication
(i.e.
| 0982_567252567.jpg). I don't know what the first 4 digits and underscore
are
| for and I would like to be able to ignore that.
|
| So if I enter drug number 567252567 in box A1 - it will look for that
string
| (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg) into A2.
|
| The good thing is that the number regardless of what is in front of it
will
| be unique.
|
| The point of doing this is that we print out drug information for seniors.
| When we type in the DIN number it will insert a picture of the pill they
| need to take preventing medication errors.
|
| Any help is most appreciated as always,
|
| Best regards,
|
| James Norton
|
|
 
J

James Norton

Hi William,

Thank you so much for this code, it works very well and I wouldn't have been
able to do this without you.

Would you be able to help me accomplish one more thing with this task? As it
is now the image is inserted into the document to the full size of the
image. How can it be set to insert the image into that cell, and only to the
existing size of that cell.

Thank you,

James Norton
 
J

James Norton

I should have mentioned this earlier also but I just noticed it. There is a
maximum possibility of 10 numeric lines, therefore there is the possibility
of 10 images per sheet. All these pictures will have a specific cell they
will be placed into based on the originating cell.

i.e. A1 numeric value will have the image placed in 11A
A2 numberic value will have the image placed in 11B etc. etc.

Thanks again for your help.

James Norton
 
W

William

Hi James

Try.....

Sub test()
Application.ScreenUpdating = False
Dim i As Integer, p As Picture
With Application.FileSearch
..NewSearch
..LookIn = "c:\pics"
..SearchSubFolders = False
..FileName = "*" & ActiveSheet.Range("A1") & ".jpg"
..MatchTextExactly = True
..Execute
For i = 1 To .FoundFiles.Count
With ActiveSheet
..DrawingObjects.Delete
Set p = .Pictures.Insert(Application.FileSearch.FoundFiles(i))
..DrawingObjects(p.Name).Left = .Columns("A").Left
..DrawingObjects(p.Name).Top = .Rows(2).Top
..DrawingObjects(p.Name).Width = .Columns("B").Left - .Columns("A").Left
..DrawingObjects(p.Name).Height = .Rows(3).Top - .Rows(2).Top
..DrawingObjects(p.Name).Placement = xlMoveAndSize
..DrawingObjects(p.Name).PrintObject = True
End With
Exit For
Next i
End With
Application.ScreenUpdating = True
End Sub



--
XL2002
Regards

William

(e-mail address removed)

| Hi William,
|
| Thank you so much for this code, it works very well and I wouldn't have
been
| able to do this without you.
|
| Would you be able to help me accomplish one more thing with this task? As
it
| is now the image is inserted into the document to the full size of the
| image. How can it be set to insert the image into that cell, and only to
the
| existing size of that cell.
|
| Thank you,
|
| James Norton
| | > Hi James
| >
| > Try this code
| >
| > Sub test()
| > Dim s As String, i As Integer
| > s = "c:\pics"
| > ActiveSheet.Range("A2").Select
| > With Application.FileSearch
| > .NewSearch
| > .LookIn = s
| > .SearchSubFolders = False
| > .Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
| > .MatchTextExactly = True
| > .Execute
| > For i = 1 To .FoundFiles.Count
| > ActiveSheet.DrawingObjects.Delete
| > ActiveSheet.Pictures.Insert (.FoundFiles(i))
| > Exit For
| > Next i
| > End With
| > End Sub
| >
| >
| > --
| > XL2002
| > Regards
| >
| > William
| >
| > (e-mail address removed)
| >
| > | > | Hi there,
| > |
| > | I am trying to figure out how I can insert a picture (jpg) based on a
| > number
| > | in another box.
| > |
| > | I have a database of over 1500 pictures at a pharmacy of the different
| > meds.
| > | The file name is always a DIN number and is unique to that medication
| > (i.e.
| > | 0982_567252567.jpg). I don't know what the first 4 digits and
underscore
| > are
| > | for and I would like to be able to ignore that.
| > |
| > | So if I enter drug number 567252567 in box A1 - it will look for that
| > string
| > | (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg) into
| A2.
| > |
| > | The good thing is that the number regardless of what is in front of it
| > will
| > | be unique.
| > |
| > | The point of doing this is that we print out drug information for
| seniors.
| > | When we type in the DIN number it will insert a picture of the pill
they
| > | need to take preventing medication errors.
| > |
| > | Any help is most appreciated as always,
| > |
| > | Best regards,
| > |
| > | James Norton
| > |
| > |
| >
| >
|
|
 
W

William

Hi James

I don't understand what you mean by
".....i.e. A1 numeric value will have the image placed in 11A
A2 numberic value will have the image placed in 11B etc. etc."
Please clarify.

--
XL2002
Regards

William

(e-mail address removed)

| I should have mentioned this earlier also but I just noticed it. There is
a
| maximum possibility of 10 numeric lines, therefore there is the
possibility
| of 10 images per sheet. All these pictures will have a specific cell they
| will be placed into based on the originating cell.
|
| i.e. A1 numeric value will have the image placed in 11A
| A2 numberic value will have the image placed in 11B etc. etc.
|
| Thanks again for your help.
|
| James Norton
| | > Hi James
| >
| > Try this code
| >
| > Sub test()
| > Dim s As String, i As Integer
| > s = "c:\pics"
| > ActiveSheet.Range("A2").Select
| > With Application.FileSearch
| > .NewSearch
| > .LookIn = s
| > .SearchSubFolders = False
| > .Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
| > .MatchTextExactly = True
| > .Execute
| > For i = 1 To .FoundFiles.Count
| > ActiveSheet.DrawingObjects.Delete
| > ActiveSheet.Pictures.Insert (.FoundFiles(i))
| > Exit For
| > Next i
| > End With
| > End Sub
| >
| >
| > --
| > XL2002
| > Regards
| >
| > William
| >
| > (e-mail address removed)
| >
| > | > | Hi there,
| > |
| > | I am trying to figure out how I can insert a picture (jpg) based on a
| > number
| > | in another box.
| > |
| > | I have a database of over 1500 pictures at a pharmacy of the different
| > meds.
| > | The file name is always a DIN number and is unique to that medication
| > (i.e.
| > | 0982_567252567.jpg). I don't know what the first 4 digits and
underscore
| > are
| > | for and I would like to be able to ignore that.
| > |
| > | So if I enter drug number 567252567 in box A1 - it will look for that
| > string
| > | (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg) into
| A2.
| > |
| > | The good thing is that the number regardless of what is in front of it
| > will
| > | be unique.
| > |
| > | The point of doing this is that we print out drug information for
| seniors.
| > | When we type in the DIN number it will insert a picture of the pill
they
| > | need to take preventing medication errors.
| > |
| > | Any help is most appreciated as always,
| > |
| > | Best regards,
| > |
| > | James Norton
| > |
| > |
| >
| >
|
|
 
T

Tom Ogilvy

Note that the attribute

..MatchTextExactly = True

has nothing to do with the name of the file. It is used if you are looking
for a text string within the file.
 
W

William

Hi Tom

You are, unsurprisingly(!), quite right and that line of code should be
excluded from the sub.

Apologies to the OP.

--
XL2002
Regards

William

(e-mail address removed)

| Note that the attribute
|
| .MatchTextExactly = True
|
| has nothing to do with the name of the file. It is used if you are
looking
| for a text string within the file.
|
| --
| Regards,
| Tom Ogilvy
|
| | > Hi James
| >
| > Try.....
| >
| > Sub test()
| > Application.ScreenUpdating = False
| > Dim i As Integer, p As Picture
| > With Application.FileSearch
| > .NewSearch
| > .LookIn = "c:\pics"
| > .SearchSubFolders = False
| > .FileName = "*" & ActiveSheet.Range("A1") & ".jpg"
| > .MatchTextExactly = True
| > .Execute
| > For i = 1 To .FoundFiles.Count
| > With ActiveSheet
| > .DrawingObjects.Delete
| > Set p = .Pictures.Insert(Application.FileSearch.FoundFiles(i))
| > .DrawingObjects(p.Name).Left = .Columns("A").Left
| > .DrawingObjects(p.Name).Top = .Rows(2).Top
| > .DrawingObjects(p.Name).Width = .Columns("B").Left - .Columns("A").Left
| > .DrawingObjects(p.Name).Height = .Rows(3).Top - .Rows(2).Top
| > .DrawingObjects(p.Name).Placement = xlMoveAndSize
| > .DrawingObjects(p.Name).PrintObject = True
| > End With
| > Exit For
| > Next i
| > End With
| > Application.ScreenUpdating = True
| > End Sub
| >
| >
| >
| > --
| > XL2002
| > Regards
| >
| > William
| >
| > (e-mail address removed)
| >
| > | > | Hi William,
| > |
| > | Thank you so much for this code, it works very well and I wouldn't
have
| > been
| > | able to do this without you.
| > |
| > | Would you be able to help me accomplish one more thing with this task?
| As
| > it
| > | is now the image is inserted into the document to the full size of the
| > | image. How can it be set to insert the image into that cell, and only
to
| > the
| > | existing size of that cell.
| > |
| > | Thank you,
| > |
| > | James Norton
| > | | > | > Hi James
| > | >
| > | > Try this code
| > | >
| > | > Sub test()
| > | > Dim s As String, i As Integer
| > | > s = "c:\pics"
| > | > ActiveSheet.Range("A2").Select
| > | > With Application.FileSearch
| > | > .NewSearch
| > | > .LookIn = s
| > | > .SearchSubFolders = False
| > | > .Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
| > | > .MatchTextExactly = True
| > | > .Execute
| > | > For i = 1 To .FoundFiles.Count
| > | > ActiveSheet.DrawingObjects.Delete
| > | > ActiveSheet.Pictures.Insert (.FoundFiles(i))
| > | > Exit For
| > | > Next i
| > | > End With
| > | > End Sub
| > | >
| > | >
| > | > --
| > | > XL2002
| > | > Regards
| > | >
| > | > William
| > | >
| > | > (e-mail address removed)
| > | >
| > | > | > | > | Hi there,
| > | > |
| > | > | I am trying to figure out how I can insert a picture (jpg) based
on
| a
| > | > number
| > | > | in another box.
| > | > |
| > | > | I have a database of over 1500 pictures at a pharmacy of the
| different
| > | > meds.
| > | > | The file name is always a DIN number and is unique to that
| medication
| > | > (i.e.
| > | > | 0982_567252567.jpg). I don't know what the first 4 digits and
| > underscore
| > | > are
| > | > | for and I would like to be able to ignore that.
| > | > |
| > | > | So if I enter drug number 567252567 in box A1 - it will look for
| that
| > | > string
| > | > | (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg)
| into
| > | A2.
| > | > |
| > | > | The good thing is that the number regardless of what is in front
of
| it
| > | > will
| > | > | be unique.
| > | > |
| > | > | The point of doing this is that we print out drug information for
| > | seniors.
| > | > | When we type in the DIN number it will insert a picture of the
pill
| > they
| > | > | need to take preventing medication errors.
| > | > |
| > | > | Any help is most appreciated as always,
| > | > |
| > | > | Best regards,
| > | > |
| > | > | James Norton
| > | > |
| > | > |
| > | >
| > | >
| > |
| > |
| >
| >
|
|
 
W

William

James

Please post to the ng rather than me directly so others can follow the
thread.

I'm assuming you have a list of what you term "numeric lines" in A1 to A10
and you want the corresponding picture in B1 to B10.

Sub test()
Application.ScreenUpdating = False
Dim i As Integer, p As Picture, r As Range, c As Range, ii As Integer
ii = 0
Set r = ActiveSheet.Range("A1:A10")
ActiveSheet.DrawingObjects.Delete
For Each c In r
ii = ii + 1
If c <> "" Then
With Application.FileSearch
..NewSearch
..LookIn = "c:\pics"
..SearchSubFolders = False
..Filename = "*" & c & ".jpg"
..Execute
For i = 1 To .FoundFiles.Count
With ActiveSheet
Set p = .Pictures.Insert(Application.FileSearch.FoundFiles(i))
..DrawingObjects(p.Name).Left = .Columns("B").Left
..DrawingObjects(p.Name).Top = .Rows(ii).Top
..DrawingObjects(p.Name).Width = .Columns("C").Left - .Columns("B").Left
..DrawingObjects(p.Name).Height = .Rows(ii + 1).Top - .Rows(ii).Top
..DrawingObjects(p.Name).Placement = xlMoveAndSize
..DrawingObjects(p.Name).PrintObject = True
End With
Exit For
Next i
End With
End If
Next c
Application.ScreenUpdating = True
End Sub


--
XL2002
Regards

William

(e-mail address removed)

| Hi James
|
| I don't understand what you mean by
| ".....i.e. A1 numeric value will have the image placed in 11A
| A2 numberic value will have the image placed in 11B etc. etc."
| Please clarify.
|
| --
| XL2002
| Regards
|
| William
|
| (e-mail address removed)
|
| | | I should have mentioned this earlier also but I just noticed it. There
is
| a
| | maximum possibility of 10 numeric lines, therefore there is the
| possibility
| | of 10 images per sheet. All these pictures will have a specific cell
they
| | will be placed into based on the originating cell.
| |
| | i.e. A1 numeric value will have the image placed in 11A
| | A2 numberic value will have the image placed in 11B etc. etc.
| |
| | Thanks again for your help.
| |
| | James Norton
| | | | > Hi James
| | >
| | > Try this code
| | >
| | > Sub test()
| | > Dim s As String, i As Integer
| | > s = "c:\pics"
| | > ActiveSheet.Range("A2").Select
| | > With Application.FileSearch
| | > .NewSearch
| | > .LookIn = s
| | > .SearchSubFolders = False
| | > .Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
| | > .MatchTextExactly = True
| | > .Execute
| | > For i = 1 To .FoundFiles.Count
| | > ActiveSheet.DrawingObjects.Delete
| | > ActiveSheet.Pictures.Insert (.FoundFiles(i))
| | > Exit For
| | > Next i
| | > End With
| | > End Sub
| | >
| | >
| | > --
| | > XL2002
| | > Regards
| | >
| | > William
| | >
| | > (e-mail address removed)
| | >
| | > | | > | Hi there,
| | > |
| | > | I am trying to figure out how I can insert a picture (jpg) based on
a
| | > number
| | > | in another box.
| | > |
| | > | I have a database of over 1500 pictures at a pharmacy of the
different
| | > meds.
| | > | The file name is always a DIN number and is unique to that
medication
| | > (i.e.
| | > | 0982_567252567.jpg). I don't know what the first 4 digits and
| underscore
| | > are
| | > | for and I would like to be able to ignore that.
| | > |
| | > | So if I enter drug number 567252567 in box A1 - it will look for
that
| | > string
| | > | (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg)
into
| | A2.
| | > |
| | > | The good thing is that the number regardless of what is in front of
it
| | > will
| | > | be unique.
| | > |
| | > | The point of doing this is that we print out drug information for
| | seniors.
| | > | When we type in the DIN number it will insert a picture of the pill
| they
| | > | need to take preventing medication errors.
| | > |
| | > | Any help is most appreciated as always,
| | > |
| | > | Best regards,
| | > |
| | > | James Norton
| | > |
| | > |
| | >
| | >
| |
| |
|
|
 
J

James Norton

Hi William,

My response to you directly was in error, my apologies to you and the group.

I am so happy with the code you did for me, it works wonderfully. I only
need to adjust one last thing and I could use your help.

I changed the range to reflect G5:G14 and it locates the images perfectly.
However the destination of the images will be B16:K16 and I haven't quite
figured out how to accomplish this.

If there is a number in G5 for example then the image will be placed in B16.
A number in G6 will place the image in C16....and so on. Numbers in the "G"
column will result in images being placed in the 16th row.

Thank you so much,

James Norton
 
W

William

Hi James

Glad to help.

The following assumes your "jpg" numbers are in the range G5 to G14 and the
corresponding pictures are to be placed in cells B16 to K16.

Sub test()
Application.ScreenUpdating = False
Dim i As Integer, p As Picture, r As Range, c As Range, ii As Integer
ii = 1
Set r = ActiveSheet.Range("G5:G14")
ActiveSheet.DrawingObjects.Delete
For Each c In r
ii = ii + 1
If c <> "" Then
With Application.FileSearch
..NewSearch
..LookIn = "c:\pics"
..SearchSubFolders = False
..Filename = "*" & c & ".jpg"
..Execute
For i = 1 To .FoundFiles.Count
With ActiveSheet
Set p = .Pictures.Insert(Application.FileSearch.FoundFiles(i))
..DrawingObjects(p.Name).Left = .Columns(ii).Left
..DrawingObjects(p.Name).Top = .Rows(16).Top
..DrawingObjects(p.Name).Width = .Columns(ii + 1).Left - .Columns(ii).Left
..DrawingObjects(p.Name).Height = .Rows(17).Top - .Rows(16).Top
..DrawingObjects(p.Name).Placement = xlMoveAndSize
..DrawingObjects(p.Name).PrintObject = True
End With
Exit For
Next i
End With
End If
Next c
Application.ScreenUpdating = True
End Sub

--
XL2002
Regards

William

(e-mail address removed)

| Hi William,
|
| My response to you directly was in error, my apologies to you and the
group.
|
| I am so happy with the code you did for me, it works wonderfully. I only
| need to adjust one last thing and I could use your help.
|
| I changed the range to reflect G5:G14 and it locates the images perfectly.
| However the destination of the images will be B16:K16 and I haven't quite
| figured out how to accomplish this.
|
| If there is a number in G5 for example then the image will be placed in
B16.
| A number in G6 will place the image in C16....and so on. Numbers in the
"G"
| column will result in images being placed in the 16th row.
|
| Thank you so much,
|
| James Norton
|
|
| | > James
| >
| > Please post to the ng rather than me directly so others can follow the
| > thread.
| >
| > I'm assuming you have a list of what you term "numeric lines" in A1 to
A10
| > and you want the corresponding picture in B1 to B10.
| >
| > Sub test()
| > Application.ScreenUpdating = False
| > Dim i As Integer, p As Picture, r As Range, c As Range, ii As Integer
| > ii = 0
| > Set r = ActiveSheet.Range("A1:A10")
| > ActiveSheet.DrawingObjects.Delete
| > For Each c In r
| > ii = ii + 1
| > If c <> "" Then
| > With Application.FileSearch
| > .NewSearch
| > .LookIn = "c:\pics"
| > .SearchSubFolders = False
| > .Filename = "*" & c & ".jpg"
| > .Execute
| > For i = 1 To .FoundFiles.Count
| > With ActiveSheet
| > Set p = .Pictures.Insert(Application.FileSearch.FoundFiles(i))
| > .DrawingObjects(p.Name).Left = .Columns("B").Left
| > .DrawingObjects(p.Name).Top = .Rows(ii).Top
| > .DrawingObjects(p.Name).Width = .Columns("C").Left - .Columns("B").Left
| > .DrawingObjects(p.Name).Height = .Rows(ii + 1).Top - .Rows(ii).Top
| > .DrawingObjects(p.Name).Placement = xlMoveAndSize
| > .DrawingObjects(p.Name).PrintObject = True
| > End With
| > Exit For
| > Next i
| > End With
| > End If
| > Next c
| > Application.ScreenUpdating = True
| > End Sub
| >
| >
| > --
| > XL2002
| > Regards
| >
| > William
| >
| > (e-mail address removed)
| >
| > | > | Hi James
| > |
| > | I don't understand what you mean by
| > | ".....i.e. A1 numeric value will have the image placed in 11A
| > | A2 numberic value will have the image placed in 11B etc. etc."
| > | Please clarify.
| > |
| > | --
| > | XL2002
| > | Regards
| > |
| > | William
| > |
| > | (e-mail address removed)
| > |
| > | | > | | I should have mentioned this earlier also but I just noticed it.
There
| > is
| > | a
| > | | maximum possibility of 10 numeric lines, therefore there is the
| > | possibility
| > | | of 10 images per sheet. All these pictures will have a specific cell
| > they
| > | | will be placed into based on the originating cell.
| > | |
| > | | i.e. A1 numeric value will have the image placed in 11A
| > | | A2 numberic value will have the image placed in 11B etc. etc.
| > | |
| > | | Thanks again for your help.
| > | |
| > | | James Norton
| > | | | > | | > Hi James
| > | | >
| > | | > Try this code
| > | | >
| > | | > Sub test()
| > | | > Dim s As String, i As Integer
| > | | > s = "c:\pics"
| > | | > ActiveSheet.Range("A2").Select
| > | | > With Application.FileSearch
| > | | > .NewSearch
| > | | > .LookIn = s
| > | | > .SearchSubFolders = False
| > | | > .Filename = "*" & ActiveSheet.Range("A1") & ".jpg"
| > | | > .MatchTextExactly = True
| > | | > .Execute
| > | | > For i = 1 To .FoundFiles.Count
| > | | > ActiveSheet.DrawingObjects.Delete
| > | | > ActiveSheet.Pictures.Insert (.FoundFiles(i))
| > | | > Exit For
| > | | > Next i
| > | | > End With
| > | | > End Sub
| > | | >
| > | | >
| > | | > --
| > | | > XL2002
| > | | > Regards
| > | | >
| > | | > William
| > | | >
| > | | > (e-mail address removed)
| > | | >
| > | | > | > | | > | Hi there,
| > | | > |
| > | | > | I am trying to figure out how I can insert a picture (jpg) based
| > on
| > a
| > | | > number
| > | | > | in another box.
| > | | > |
| > | | > | I have a database of over 1500 pictures at a pharmacy of the
| > different
| > | | > meds.
| > | | > | The file name is always a DIN number and is unique to that
| > medication
| > | | > (i.e.
| > | | > | 0982_567252567.jpg). I don't know what the first 4 digits and
| > | underscore
| > | | > are
| > | | > | for and I would like to be able to ignore that.
| > | | > |
| > | | > | So if I enter drug number 567252567 in box A1 - it will look for
| > that
| > | | > string
| > | | > | (567252567) in c:\pics\ and insert that jpg (0982_567252567.jpg)
| > into
| > | | A2.
| > | | > |
| > | | > | The good thing is that the number regardless of what is in front
| > of
| > it
| > | | > will
| > | | > | be unique.
| > | | > |
| > | | > | The point of doing this is that we print out drug information
for
| > | | seniors.
| > | | > | When we type in the DIN number it will insert a picture of the
| > pill
| > | they
| > | | > | need to take preventing medication errors.
| > | | > |
| > | | > | Any help is most appreciated as always,
| > | | > |
| > | | > | Best regards,
| > | | > |
| > | | > | James Norton
| > | | > |
| > | | > |
| > | | >
| > | | >
| > | |
| > | |
| > |
| > |
| >
| >
|
|
|
|
|
 
J

JavyD

Hey guys, this formula is just for me, it could save me hours of work. But
it's not working. I put in the item # in cell F38, I want the picture in
Cell W8. Both cells are merged is this a problem? My pictures are in folder
My Pictures. Can you help pleaseeee?
 
J

JE McGimpsey

Somehow you've doubled them. There should only be one dot before each of
these methods. See

"Using With Statements"

in XL Help.
 
J

JE McGimpsey

I give up. What does "not working" mean?

Are you still getting syntax errors? run-time errors? wrong results? no
results? XL crashing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top