Insert Picture From Folder

Hi,

I am using the code below to insert and resize images in excel. I was wondering is it possible to set up this macro so that I can just provide the directory and then have it so that just a random image is inserted rather than specifying an jpg number. The reason i need this is because the numbers in the folder range from 00000 to upto 20000 however not every folder has the full range of images i.e. Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text may just contain one image and that would be image number 03965.

The other thing I would like to do is to have the name of the las 2 subfolders inserted into the cell above the image so for the example below you would have:

Millenium Copthorne InternationalTVGI Race Name Text
Picture

Millenium Copthorne InternationalTVGI Race Name Logo
Picture

Is this possible?


	VB:
	
 TestInsertPictureInRange() 
    InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text3965.jpg", _ 
    Range("B5:D10") 
    InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Logo0015.jpg", _ 
    Range("E5:G10") 
End Sub 
 
Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range) 
     ' inserts a picture and resizes it to fit the TargetCells range
    Dim p As Object, t As Double, l As Double, w As Double, h As Double 
    If TypeName(ActiveSheet)  "Worksheet" Then Exit Sub 
    If Dir(PictureFileName) = "" Then Exit Sub 
     ' import picture
    Set p = ActiveSheet.Pictures.Insert(PictureFileName) 
     ' determine positions
    With TargetCells 
        t = .Top 
        l = .Left 
        w = .Offset(0, .Columns.Count).Left - .Left 
        h = .Offset(.Rows.Count, 0).Top - .Top 
    End With 
     ' position picture
    With p 
        .Top = t 
        .Left = l 
        .Width = w 
        .Height = h 
    End With 
    Set p = Nothing 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


I'm working at a Marina and trying to make a comparison chart for different
types of boats. I am trying to make a list, and based upon the users
selection of a boat, insert a corresponding picture to match the boat
selected from that list. I've researched other thread discussions, and tried
to approach it this way, as reccommended by Ron Coder

Select Sheet2 and turn off Grid Lines
(Tools>Options>View tab:Uncheck Grid Lines)
1)For each picture to be displayed:
1a. Insert>Picture from file. (select picture, put it in the sheet and
resize it).
1b. Select the range of cells that contains the picture.
1c. Name that range of cells, using the prefix "pic" followed by the
dropdown list text:
Example for a picture of an Elephant on cells A210:
Select those cells
Insert>Name>Define
Name: picElephant

2)Build your data validation list on a cell in Sheet1 and pick one of the
items.
If you need help: use Debra Dalgleish's site:
http://www.contextures.com/xlDataVal01.html

3)Create a dynamic range name that refers to that cell:
Insert>Name>Define
Name: ShowMyPic
RefersTo: =INDIRECT("pic"&Sheet1!$A$1)
....or whatever cell you chose.

4)Copy/Paste one of the pictures from Sheet2 to the display cell on Sheet1.

5)With picture selected, type this in the formula bar, then press [Enter]:
=ShowMyPic

After trying this method, instead of getting the picture inserted, I get the
name of the cells that the picture is in...(the name I gave the cells that
contained the picture). It does change according to my selection from the
list, but doesnt display the picture. The text that is returned instead of
the picture seems distorted as well. Any ideas of what I could be doing
wrong? I've also tried making this work through macros which I am even
less familiar with. I was able to get that to work for one selection, but I
dont know how to properly code it to work for every boat in my list. I used
this code reccommended by Bernie Deitrick:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Target.Address "$A$1" Then Exit Sub
If Target.Value = "Yes" Then
Application.ScreenUpdating = False
Range("B9").Select
ActiveSheet.Pictures.Insert( _
"C:Documents and SettingsPHILMy DocumentsMy
Picturestest.jpg").Select
Selection.Name = "PictureName"
Range("A2").Select
Application.ScreenUpdating = True
Else
On Error Resume Next
ActiveSheet.Shapes("PictureName").Delete
End If
End Sub

I assume I would need to somehow nest this or create If - Else commands?
Also to clarify, I did change the file names and paths to those that matched
my project. It worked for one selection, but I don't know how to code it for
a list of say 40 boats

Any suggestions of the easiest way to go about doing this? Ive been trying
for a few days now, and could use any help I can get!

I'm working at a Marina and trying to make a comparison chart for different
types of boats. I am trying to make a list, and based upon the users
selection of a boat, insert a corresponding picture to match the boat
selected from that list. I've researched other thread discussions, and tried
to approach it this way, as reccommended by Ron Coderre:

Select Sheet2 and turn off Grid Lines
(Tools>Options>View tab:Uncheck Grid Lines)
1)For each picture to be displayed:
1a. Insert>Picture from file. (select picture, put it in the sheet and
resize it).
1b. Select the range of cells that contains the picture.
1c. Name that range of cells, using the prefix "pic" followed by the
dropdown list text:
Example for a picture of an Elephant on cells A2:D10:
Select those cells
Insert>Name>Define
Name: picElephant

2)Build your data validation list on a cell in Sheet1 and pick one of the
items.
If you need help: use Debra Dalgleish's site:
http://www.contextures.com/xlDataVal01.html

3)Create a dynamic range name that refers to that cell:
Insert>Name>Define
Name: ShowMyPic
RefersTo: =INDIRECT("pic"&Sheet1!$A$1)
....or whatever cell you chose.

4)Copy/Paste one of the pictures from Sheet2 to the display cell on Sheet1.

5)With picture selected, type this in the formula bar, then press [Enter]:
=ShowMyPic

After trying this method, instead of getting the picture inserted, I get the
name of the cells that the picture is in...(the name I gave the cells that
contained the picture). It does change according to my selection from the
list, but doesnt display the picture. The text that is returned instead of
the picture seems distorted as well. Any ideas of what I could be doing
wrong? I've also tried making this work through macros which I am even
less familiar with. I was able to get that to work for one selection, but I
dont know how to properly code it to work for every boat in my list. I used
this code reccommended by Bernie Deitrick:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count <> 1 Then Exit Sub
If Target.Address <> "$A$1" Then Exit Sub
If Target.Value = "Yes" Then
Application.ScreenUpdating = False
Range("B9").Select
ActiveSheet.Pictures.Insert( _
"C:Documents and SettingsPHILMy DocumentsMy
Picturestest.jpg").Select
Selection.Name = "PictureName"
Range("A2").Select
Application.ScreenUpdating = True
Else
On Error Resume Next
ActiveSheet.Shapes("PictureName").Delete
End If
End Sub

I assume I would need to somehow nest this or create If - Else commands?
Also to clarify, I did change the file names and paths to those that matched
my project. It worked for one selection, but I don't know how to code it for
a list of say 40 boats

Any suggestions of the easiest way to go about doing this? Ive been trying
for a few days now, and could use any help I can get!

Hi guys,

Is there a VBA code for copying all pictures from a certain folder & inserting them into a excel file then resizing them to 5cm square & assigning this to a button that when you press it, it does the above?

Thanks Peter

I was wondering if it's at all possible for a user's selection to determine the name of the file to be opened. For example, below is just a section of my code and when satisfying the elseif statement the correct number appears. What I have happening is the three picture from file being inserted into the three ranges. The problem I have is that the code would be exceedingly long if I continued with this throughout the entire code. Is there a way I could insert the variable "number" as the file name that I'm inserting?


	VB:
	
 
    number = 28 
    InsertPictureInRange "C:Documents and SettingstmuzaDesktopNew DatabaseDatabase Images312312_25028.jpg", _ 
    Range("I7") 
    InsertPictureInRange "C:Documents and SettingstmuzaDesktopNew DatabaseDatabase Images312312_25029.jpg", _ 
    Range("I19") 
    InsertPictureInRange "C:Documents and SettingstmuzaDesktopNew DatabaseDatabase Images312312_25030.jpg", _ 
    Range("I31") 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Scan cards with invertory of steel sizes & MTR mill test reports to work
sheets make new work book for each card scan in sames as I did in excel 2003
Insert Picture from scanner or camera

Hi All,

I have been reading many posts about using code to insert pictures from a
folder into an area of a spreadsheet and have made them work according to the
many people who have posted here. Most posts say that either you enter a name
or number in a cell that corresponds to a pic, or use a data validation box
to do a lookup. Again, I have made each of these methods work. My question:
Can you make it work using an Active X combo box? I am able to make all the
code work, but the picture just does not materialize. Alternately are you
able to make a data validation box perform an auto complete as the combo box
does?
Basically I have 8000 enrties of part numbers and with the combo box I can
start typing the first numbers or letters and the box jumps to that part of
the list.

Thanks in advance.

Squeaky

I am able to work out a code to upload pictures from my files using this:


	VB:
	
 
 
 
Private Sub cmdfind_Click() 
    Application.ScreenUpdating = False 
    Dim strfind As String 
    Dim rsearch As Range 
    Dim strfolder As String 
    Dim strname As String 
    Dim strpic As String 
    Dim b As Range 
     
    Set rsearch = Worksheets("m").Range("ap3", Range("ap65536").End(xlUp)) 
     
     'define path to images
    strfolder = "F:SEC FILESMAC2PIC" 
     
     'get data from userform
    strname = frmsearch.txt201.Value 
     
     'check if pic exists
    strpic = strfolder & strname & ".jpg" 
     
     'lets do some validation
     
    With rsearch 
         
        Set b = .Find(strname) 
        On Error Resume Next 
        If b Is Nothing Then 
            Image1.Picture = LoadPicture(strpic) 
             
            On Error Goto 0 
             
             
        End If 
    End With 
     
     
     
    Application.ScreenUpdating = True 
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
How do i work around this code now to help me avoid the 'File Not Found' error if the picture is not available in my file folder?

Any advice would be appreciated.

Hi All,

I’m new and this is my first post after looking on here many times in the past so please be gentle

I’m struggling to get the following done and not really sure where to start!

I have a spreadsheet with 2 sheets, sheet 1 i need to insert a picture from a URL that has to be looked up from sheet 2

What I need it to do:

In cell A2, look up a code that is in C2 and return the URL that is located in sheet 2 in cell C2

=VLOOKUP(C2,'datafeed_United Kingdom'!1:1048576,3,FALSE) is what i have used for that part

This will give me the URL I need in cell C2.

Now this is the part I’m struggling with - then I need the picture from the URL returned into the cell (C2) and then to proceed to the cell below A2 and to the same, and so and so on

(I have already made the cell heights 204 and centred the text)

I need this to happen for 532 rows, sometimes more so you can see why I don’t want to do this manually!

Im using Excel 2007

Any help would be gratefully appreciated

Many thanks in advance and please tell me if you need any more info or if i have missed anything out or if this is even possible??

Jamieray

Scan cards with invertory of steel sizes & MTR mill test reports to work
sheets make new work book for each card scan in sames as I did in excel 2003
Insert Picture from scanner or camera


"Gord Dibben" wrote:

> Re-phrase to "don't work as one would like" and you are correct.
>
> Objects sit on top of cells, not in them.
>
> Gord Dibben Excel MVP
>
> On Thu, 4 Nov 2004 20:07:05 -0800, penciline
> > wrote:
>
> >I am sorrry to disappoint you but the Insert Picture or Insert Object
> >functions don't work as one would expect.
> >In Excel 2003 if you insert a picture into cell A1 you would expect A1 to
> >expand to fit the dimensions of the image. However, this is not the case.
> >All that happens is the image gets placed on top of your spreadsheet and you
> >have to manually resize the cells. This technique is faulty because you are
> >not sure that the image rests on the inside of a cell.
> >
> >What I would like to know is how to have the cells automatically resize for
> >the image that is imported. Can someone please post a reply to this
> >question? Thanks in advance
> >"bindu" wrote:
> >
> >> click on the insert option on the menu bar and click on insert picture
> >>
> >> "bindu" wrote:
> >>
> >> > how to insert picture in a excel sheet
> >> > --
> >> > bindu
>
> Why would you NOT expect that when you click on a cell, then go to Insert/ Picture/ From File, that the picture would not sit IN the cell you clicked on? I can see where we should have the oportunity to have the picture "float" if indeed that is what we want, but not to have the picture "float" with no other options. Is there NO other option to putting a picture in a cell? Even as a link? Just as long as it is IN the cell.

In Excel 2003 someone here had created a custom button on the Formatting
toolbar in Excel that would insert a picture. (The picture is a .bmp file
that is a checkmark)
This would allow the user to quickly insert the checkmark into a cell.
Does anyone know how to create a custom button in Excel 2007 to insert
picture from file, without having to browse for the picture file?

--
Thanks for your help.

I want to create a template and distribute it to employees wherein I want
some cells to be non editable. Hence I lock concerned cells and then protect
worksheet.
But then I want this file back from them after filling in required details
and inserting their scanned signature at bottom.
Here once sheet is protected, cannot insert picture from file even in
unlocked cells.
I have to tell them to copy and paste the picture wherein I want them to
insert picture.
How do i do it?

Hello,

I use the code below to insert pictures from certain location as well as the file names into excel. I am trying to adjust the column width and row heights dynamically to fit the inserted picture size by using "Autofit" method for both entirerow & entirecolumn. But doesn't work as intended.

Just follow the "***" below.

I appreciate your help. Thanks

Private Sub CommandButton1_Click()
Dim strPath As String
Dim strFile As String
Dim objPic As Object
Dim cl As Range
On Error Resume Next
strPath = "C:"
strFile = Dir(strPath & "*.jpg")

Set cl = Range("A1").Select

With ActiveSheet
Do While strFile <> ""
myNum = Val(strFile)

ActiveCell.Offset(rowOffset:=2, columnOffset:=0).Activate

Set objPic = .Pictures.Insert(strPath & strFile)

ActiveCell.EntireRow.AutoFit
ActiveCell.EntireColumn.AutoFit

'With cl.Offset(rowOffset:=0, columnOffset:=0).Select "redundant"

' Insert code to resize and maintain aspect ratio

objPic.Width = (objPic.Width) * 0.35
objPic.Height = (objPic.Height) * 0.35

' (****) Modify the following code to dynamically adjust column width and row width to be same as the picture size instead of hard coding-doesn't work

ActiveCell.EntireRow.AutoFit
ActiveCell.EntireColumn.AutoFit
' ActiveCell.ColumnWidth = 57
' ActiveCell.RowHeight = 227

' Type file name in the adjacent column
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Value = "File Name: " & strFile

' End With
strFile = Dir()
Loop

End With

End Sub

I am using excel 2003 on windows 7
When I go to insert a "picture from file", the thumbnails are so small
I can hardly see what each pitcure is.
Is there a way to make thumbnails bigger by defalt?
If anyone has an answer or can suggest any other way to insert pictures
from a list / file, that I can actually see, please let me know.
I insert about 30 or so pictures in each report.

Thanks / RS

I need to excel 2007 to be able to insert picture from scanner and camera
just like it does in excel 2003 I need to be able to insert inventory card
and mill test reports

Thanks for any help

Jerry Stone

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...heet.functions

Hi There!

I am managing my stock with excel.
For every item I inserted a picture (through insert->picture->from file)
When I want to filter the stock the pictures overlap and it is very irritating.
Is there any way to lock the pictures in order to disappear when I filter certain cells?

Thanks

I need to protect a worksheet (with password) and still allow user to insert
Picture (from file only, if that helps), how can I accomplish this?

Hi,

I am using the code below to insert and resize images in excel. I was wondering is it possible to set up this macro so that I can just provide the directory and then have it so that just a random image is inserted rather than specifying an jpg number. The reason i need this is because the numbers in the folder range from 00000 to upto 20000 however not every folder has the full range of images i.e. Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text may just contain one image and that would be image number 03965.

The other thing I would like to do is to have the name of the las 2 subfolders inserted into the cell above the image so for the example below you would have:

Millenium Copthorne InternationalTVGI Race Name Text
Picture

Millenium Copthorne InternationalTVGI Race Name Logo
Picture

Is this possible?

Sub TestInsertPictureInRange() 
    InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne
InternationalTVGI Race Name Text3965.jpg", _ 
    Range("B5:D10") 
    InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne
InternationalTVGI Race Name Logo0015.jpg", _ 
    Range("E5:G10") 
End Sub 
 
Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range) 
     ' inserts a picture and resizes it to fit the TargetCells range
    Dim p As Object, t As Double, l As Double, w As Double, h As Double 
    If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub 
    If Dir(PictureFileName) = "" Then Exit Sub 
     ' import picture
    Set p = ActiveSheet.Pictures.Insert(PictureFileName) 
     ' determine positions
    With TargetCells 
        t = .Top 
        l = .Left 
        w = .Offset(0, .Columns.Count).Left - .Left 
        h = .Offset(.Rows.Count, 0).Top - .Top 
    End With 
     ' position picture
    With p 
        .Top = t 
        .Left = l 
        .Width = w 
        .Height = h 
    End With 
    Set p = Nothing 
End Sub


Hi, I'm sure this is simple, but I have not a clue what I need to do.

I'm looking for an image to be automatically inserted into a cell from a folder on the network, by referencing a part number in another cell.

E.G. i have a picture (.tif) with number 520-005-002, with a file path, C:MY DOCUMENTSMY PICTURES520-005-002.tif

I'd like to put the picture number 520-005-002 in cell "A6" and it automatically insert and size the picture in cell "F6"
and for this to continue respectively down through the rows so a different number in "A23" inserts and sizes the required picture in "F23"

My VBA code currently copys a picture from a folder on my desktop and inerts it into a spreadsheet using the following arguments.


	VB:
	
 InsertPictureIG() 
    InsertPictureAInRange "C:Documents and SettingsJoe ArledgeDesktopFEM_oil_sealIG.gif", _ 
    Range("F16:K26") 
End Sub 
-------------------------------------------------------------------------------- 
Sub InsertPictureAInRange(PictureFileName As String, TargetCells As Range) 
     ' inserts a picture and resizes it to fit the TargetCells range
    Dim p As Object, t As Double, l As Double, w As Double, h As Double 
    If TypeName(ActiveSheet)  "Worksheet" Then Exit Sub 
    If Dir(PictureFileName) = "" Then Exit Sub 
     ' import picture
    Set p = ActiveSheet.Pictures.Insert(PictureFileName) 
     ' determine positions
    With TargetCells 
        t = .Top 
        l = .Left 
        w = .Offset(0, .Columns.Count).Left - .Left 
        h = .Offset(.Rows.Count, 0).Top - .Top 
    End With 
     ' position picture
    With p 
        .Top = t 
        .Left = l 
        .Width = w 
        .Height = h 
    End With 
    Set p = Nothing 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
What I would like to do is be able to insert the picture in the spreadsheet no matter where the folder is saved. For example, if I send the folder to someone and they run the code with the folder saved on their desktop. The picture is in the same folder as the workbook.
Any suggestions?
Joe

Hi,

I have a user trying to insert a relatively ordinary jpeg file into Excel, when she does so all she sees is an outline of the image size. The only way to actually see the image is to right-click on it and select "Format Picture" and selecting "Reset" from the picture tab. This happens with any jpeg image regardless of file-size.

Inserting the same image into Word works fine - I do not have this problem inserting these files into Excel on my PC.

All are using the same version, 2003 with the same SP version.

Many thanks in advance.

Mike

Problem Nature:
Insert picture in row equivalent to filename, set shape color as result
When I need it:
Beginning of next week (17/18 of August)
Payment Amount: 15,- USD via PAYPAL

Details:
Hello everyone. I have a rather minor problem for the Excel Gods in here I believe.
My Report/Workbook holds two sheets. One called "Pictures" which needs to have pictures imported and cropped (both done already), and then insert the cropped picure into cell B3 onwards (down - B3, B4, B5, etc.). All of this actually, I have already accomplished on my own. Here the problem I need you to take care about.

The name of the picture files is always like 1.bmp, 2.bmp, 3.bmp, etc. . The picture MUST be inserted in the row equivalent to the filename.
Eg. if I import 21.bmp it MUST be inserted into cell B21, if I import 5.bmp it must be imported into B5, and so on. This is crucial since I am using another macro which generates a userform to show that picture later.

That is step one. The other step is, once this is done, I need the macro to copy a shape (a star) from the current sheet, located in G2, to my other sheet called "VIP", and there start pasting it in all cells in range L3:L50. And here comes the challenge. IF I have a picture in, for example, cell B10 on my "Picture" sheet, I need that shape (star) which has been copied to the "VIP" sheet, to be YELLOW. The endresult should be that there are many yellow stars, eaning picture is available, and a few white stars, indicating that there is no picture.

A short recap:
1. import picures (done by myself)
2. crop pictures (done by myself)
3. insert picture into row according to filename (NEEDED)
4. COPY the shape (star) from current sheet G2 to sheet VIP into all cells in range L3:L50 (NEEDED)
5. if picture is present, change shape color to YELLOW (NEEDED)

If there are any questions please let me know.

Note: this is my first time hiring help here, but as far as I know it is more a first come, first serve policy. However, if the first acceptant gives up, number two will take his place if he wishes. A total of 15 USD will be transferred once the code is doing what I need it to do.

Thanks a lot for your help,
A2k

Here the code, if you wish to have a full workbook, please let me know, but should not be necessary.

	VB:
	
 
Sub InsertAllPictures() 
     
    Dim strPath As String 
    Dim strFileName As String 
    Dim shpTemp As Shape 
    Dim rngOutput As Range 
    Dim Alert As String 
     
     
    Rows("3:50").Select 
    Selection.RowHeight = 140 ' Set row height to 150px
     
    Columns("B:B").Select 
    Selection.ColumnWidth = 20 ' Set column width to 20px
     
    Range("B3").Select 
     
     ' Select a folder containing
    strPath = GetFolderName("Select a folder") 
    strFileName = Dir(strPath & "" & "*.bmp") 
     
    Alert = MsgBox("You selected this folder:" & strPath & "" & strFileName, 0, "Your Selection") 
     
    Set rngOutput = ActiveSheet.Range("B3") 
    Do While Len(strFileName) > 0 
        ActiveSheet.Pictures.Insert strPath + "" + strFileName 
        Set shpTemp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count) 
        With shpTemp 
            With .PictureFormat 
                .CropLeft = 269 
                .CropTop = 142 
                .CropBottom = 309 
                .CropRight = 402 
            End With 
            .Left = rngOutput.Left 
            .Top = rngOutput.Top 
        End With 
        Set rngOutput = rngOutput.Offset(1, 0) 
        strFileName = Dir 
    Loop 
     
     
     
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines


Hi all,

First of all, I would like to thank all Excel Forum Moderators and Members especially Andy Pope for the great effort they exert to help all members.

Lately, I viewed the thread available on the following link and I admired the great perfect work and codes provided by Andy Pope so much,

http://www.excelforum.com/excel-prog...-userform.html

My request is similar to the points discussed in the above mentioned thread, but, it is a little bit different ..

Instead of inserting the picture to the worksheet, I want the picture to be copied from one folder on the HD to another folder called (Employees photos), which is located in workbook's path.

In other words, I need a code to copy one jpg picture from one location to another.

For that purpose I tried the following code, but it didn't work with me !!!

Private Sub
From_File_Buttion_Click()

Dim picToOpen As String
     On Error Resume Next
picToOpen = Application.GetOpenFilename("Pics (*.jpg), *.jpg")
                
If picToOpen <> False Then
    objNewPic.Copy
    ActiveWorkbook.Path.Paste
    Unload Me
End If

On Error GoTo 0

End Sub
Can you please help me reaching my goal?

I hope that my request is clear.

Thank you,

This question kind of relates to my other thread http://www.excelforum.com/excel-programming/647505-insert-picture-and-resize-to-range-of-cells.html, but I figured it is an entirely different beast as I cannot find much information on it. I was wondering if it is possible to create a macro to insert a picture from scanner or camera.

I found this code on the internet, but can't seem to find anymore information on it or get it to work.

Anyone seen this or used this before?

Would it be possible to use in the following code replacing the Application.GetOpenFilename part?

Sub TestInsertPictureInRange()
    Dim picToOpen As String
    picToOpen = Application _
                 .GetOpenFilename("Pics (*.jpg), *.jpg")
    If picToOpen <> "" Then InsertPictureInRange picToOpen, _
                         Range("B5:D10")
End Sub
Thanks,

-Eric