+ Reply to Thread
Results 1 to 2 of 2

How can i insert the picture using emp no in excel cell value

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    Dubai
    MS-Off Ver
    Office 365 Version 2409
    Posts
    10

    How can i insert the picture using emp no in excel cell value

    hi
    I have master emp file in excel , total 500 employee records like name, emp no, contact no etc.,i want to know how can i get picture if i put the emp no against the picture

    Picture are saved in my d:\ drive

    Pls some one help

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How can i insert the picture using emp no in excel cell value

    Try this example.

    Public Sub LoadPicture()
    
    '#
    '# declarations
    '#
         Dim lngRowNumber As Long
         
    '#
    '# loop for all employee entries on the current worksheet and for each employee,
    '# insert the photo of that employee in column D on the same row using the
    '# employee number in column A
    '#
         With ActiveSheet
              For lngRowNumber = 2 To .Cells(.Rows.Count, "A").End(xlUp).Row
                   With .Pictures.Insert("D:\" & .Cells(lngRowNumber, "A").Value & ".jpg")
                        .Top = ActiveSheet.Rows(lngRowNumber).Top
                        .Left = ActiveSheet.Columns("D").Left
                   End With
              Next lngRowNumber
         End With
    
    End Sub
    If you like my contribution click the star icon!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1