Macro no longer working with new computer

sclin16

New Member
Joined
May 9, 2017
Messages
10
Hi,

I have the below macro and just got a new work comp. New comp is unable to run my macro now. I think it might be a Windows 10 issue? I'm also running Office 365. Can anyone please help? I essentially need to have a macro look up a number in column E, find the corresponding jpg in a specific folder, and populate that image in column B.

Thanks in advance for your help!
Code:
Sub Kok()
On Error Resume Next
Dim i%, ppath$, sku$


For i = 6 To 500
 sku = Cells(i, 5)
 ppath = "H:\Retail\E-Commerce\Photo Shoots" & sku & "" & sku & "_00_r17.jpg"


With ActiveSheet.Pictures.Insert(ppath)
With .ShapeRange
.LockAspectRatio = msoTrue
.Width = 30
.Height = 40
End With
.Left = ActiveSheet.Cells(i, 2).Left
.Top = ActiveSheet.Cells(i, 2).Top
.Placement = 1
.PrintObject = True
End With
Next
End Sub
 
Last edited by a moderator:
With your code the "On Error Resume Next" just masks all & any errors which can cause further problems.
Just to add to what Fluff said here, it is better to use error handling than just ignoring the errors (your problem here is a perfect example why).
In error handling, you capture the errors, and give feedback to the user, so that they know there is an issue.

I just did an example like that here today: https://www.mrexcel.com/forum/excel...e-tab-based-list-post5282157.html#post5282157
Chip Pearson wrote a good write-up on Error Handling here: http://www.cpearson.com/excel/errorhandling.htm
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top