Hello,
I have been working on a spreadsheet which catalogues images from my website to show what has been uploaded and what has not. With the volume of product with which I am working, this seems to be the "quicker" option to take - using Excel. This method is more efficient for me because it queries my image server with a "fresh" image and does not give an old cached image, but sometimes looking at it through my product catalog via web browser will, no matter how many times I flush the web browser.
However, after upgrading to Office 2013 (from Office 2010) I have noticed there is a lot of performance degredation. What would work fine in Excel 2010, now gives issues in 2013. Namely, trying to run the script below on any number of products:
brief explanation of the script: it reads each cell within range of L2 through U, which in another script its coded to fill up L2 all the way through U501 if the information is available. If any cell within this L2:U501 range has a value with a hyperlink prefix then it pulls the image and adds it into the corresponding cell, then deletes the cell contents of the hyperlink.
I do not proclaim to be any sort of Excel VBA pro or expert, but I am able and willing to learn.
This module makes every Microsoft Office application hang until it is done looping through the range, which is unfortunate because I am not able to use Word or even check my emails in Outlook until the process is finished.
I know there is a better way to do this, but I was unable to figure it out and got to the "busy time of the year" of my company's peak sales period.
Now since I have some downtime, I am looking to improve upon the spreadsheet.
My question, is there a better way to go about doing something like this? I have been looking around, but I am actually unsure of what I should use to make it better.
I have seen suggestions for using a For i = 1 to whatever loop, but I'm not sure how I'd incorporate that into my existing script. I've also seen a suggestion for a DoEvents which would free up Office applications, but again not sure what I'd be doing with it.
If anyone can help me or point me in the right direction that would be great. Also, if any more information is needed I can provide what is needed.
I have been working on a spreadsheet which catalogues images from my website to show what has been uploaded and what has not. With the volume of product with which I am working, this seems to be the "quicker" option to take - using Excel. This method is more efficient for me because it queries my image server with a "fresh" image and does not give an old cached image, but sometimes looking at it through my product catalog via web browser will, no matter how many times I flush the web browser.
However, after upgrading to Office 2013 (from Office 2010) I have noticed there is a lot of performance degredation. What would work fine in Excel 2010, now gives issues in 2013. Namely, trying to run the script below on any number of products:
Code:
Sub insertImage()
Dim rng As Range
Dim Cell As Range
Dim Pic As Picture
Set rng = Range("L2:U" & Range("L" & Rows.Count).End(xlUp).Row)
For Each Cell In rng
With Cell
On Error Resume Next
Set Pic = .Parent.Pictures.Insert(.Value)
If Err <> 0 Then
Err.Clear
Else
With .Offset(, 0)
Pic.top = .top
Pic.Left = .Left
Pic.Height = 56 '412 at 550 cell size
Pic.Width = 56 '412 at 550 cell size
ActiveSheet.Hyperlinks.Add Anchor:=Pic.ShapeRange.Item(1), Address:= _
Cell.Value
Cell.ClearContents
End With
End If
On Error GoTo 0
End With
Next Cell
End Sub
brief explanation of the script: it reads each cell within range of L2 through U, which in another script its coded to fill up L2 all the way through U501 if the information is available. If any cell within this L2:U501 range has a value with a hyperlink prefix then it pulls the image and adds it into the corresponding cell, then deletes the cell contents of the hyperlink.
I do not proclaim to be any sort of Excel VBA pro or expert, but I am able and willing to learn.
This module makes every Microsoft Office application hang until it is done looping through the range, which is unfortunate because I am not able to use Word or even check my emails in Outlook until the process is finished.
I know there is a better way to do this, but I was unable to figure it out and got to the "busy time of the year" of my company's peak sales period.
Now since I have some downtime, I am looking to improve upon the spreadsheet.
My question, is there a better way to go about doing something like this? I have been looking around, but I am actually unsure of what I should use to make it better.
I have seen suggestions for using a For i = 1 to whatever loop, but I'm not sure how I'd incorporate that into my existing script. I've also seen a suggestion for a DoEvents which would free up Office applications, but again not sure what I'd be doing with it.
If anyone can help me or point me in the right direction that would be great. Also, if any more information is needed I can provide what is needed.