• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Image size after upload much smaller than Original size ??

mave27

New Member
Ok- i have successfully managed to bulk upload images from Folder to worksheet, but image size is much smaller than original image stored in the folder.

The Orig image size is 600pxx500px, yet the sheet is showing a thumbnail size ?!

See screenshot below

http://postimg.org/image/5mxpl3ua7/

Below is macro code:

Code:
Sub InsertPic()
Dim path As String, pic As String, pname As String
Dim lastrow As Long, r As Range


path = "C:\Users\user\Desktop\MagentoCatalog\product\" 'change as req
lastrow = Range("B" & Rows.Count).End(xlUp).Row


For Each r In Range("B2:B" & lastrow)
pic = r.Value
pname = path & pic & ".jpg"
If Dir(pname) <> "" Then
With ActiveSheet.Pictures.Insert(pname)
With .ShapeRange
.LockAspectRatio = msoTrue
.Height = 125
.Width = 35
End With
.Left = Columns("C").Left
.Top = Rows(r.Row).Top
End With
Rows(r.Row).RowHeight = 125
r.Offset(0, 2).Value = pic
Else
Cells(r.Row, "C") = "**** File Not Found *****"
End If
N: Next
End Sub

How can I fix this ?
 
Because you're resizing the images in your code

Code:
With .ShapeRange
.LockAspectRatio = msoTrue
.Height = 125 'This bit changes the height
.Width = 35 ' This bit changes the width
End With
 
Thanks for the tip. I'm new to VBA. Still trying to familiarise with the Syntex style.

If I completely remove that code snippet, will the Macro place the original size image on the worksheet ?
 
Back
Top