I have been slaving away, trying desperately to piece together a huge macro for my job from what I can find on the internet. The aim is to format reports, ultimately.
This part of the code takes the value from a cell, and finds the respectively named image file in a given folder, then it "inserts" the image into a certain cell. (I know it's not technically inserting it, but still.)
The problem is that other people need to view these reports, but the images do not show when I send the workbook to them. I have no idea how to rectify this and it is such a big deal. am BEGGING YOU, please help me figure out a way to do this so that other employees will be able to see the images! My job may depend on it! :(
Dim pictureNameColumn As String
Dim picturePasteColumn As String
Dim pictureName As String
Dim lastPictureRow As Long
Dim pictureRow As Long
Dim pathForPicture As String
pictureNameColumn = "A"
picturePasteColumn = "B"
pictureRow = 4
lastPictureRow = Cells(Rows.Count, pictureNameColumn).End(xlUp).Row
pathForPicture = "C:\Users\desid\reportimages\"
Do While (pictureRow <= lastPictureRow)
pictureName = Cells(pictureRow, "A")
If (pictureName <> vbNullString) Then
If (Dir(pathForPicture & pictureName & ".jpg") <> vbNullString) Then
Cells(pictureRow, picturePasteColumn).Select
ActiveSheet.Pictures.Insert(pathForPicture & pictureName & ".jpg").Select
With Selection
.Left = Cells(pictureRow, picturePasteColumn).Left + 30
.Top = Cells(pictureRow, picturePasteColumn).Top + 3
.ShapeRange.LockAspectRatio = msoTrue
.ShapeRange.Height = 90#
.ShapeRange.Width = 90#
.ShapeRange.Rotation = 0#
End With