L2013 not running code from XL7, second posting
I have a worksheet with VBA code that has been in use for at least 12 years.
It still works flawlessly in XL7 (2007). The code opens a folder which contains 24 photos (5M each) and places them in a worksheet along with their file name and date. The code even fails when I step thru the code, but seems to hesitate for some reason. The lines of code which appears to be causing the problem is as follows: For x = 10 To 430 Step 140 If Directory = "" Then Exit Sub ActiveSheet.Shapes.AddPicture Directory & f, _ True, False, x, y, 130, 100 Cells(r, c) = f Cells(r, c + 1) = FileDateTime(Directory & f) f = Dir The line with "Shapes.AddPicture " seems to be the area of concern. XL13 appears to be handling pictures differently, but why? Any ideas about this line ?? BTW, I have tried the code approximately 25 times. I had one attempt which completed properly, but it took nearly 45 seconds to complete versus 4-5 seconds for XL7. Very strange. |
L2013 not running code from XL7, second posting
I don't have 2013 but did you check in the VBE ObjectBrowser under
Shapes.AddPicture function for a list of args. I normally specify the arg name so there's no ambiguity regardless of order... Filename:=Directory & f, LinkToFile:=False, SaveWithDocument:=True, _ Left:=x, Top:=y, Width:=130, Height:=100 -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
L2013 not running code from XL7, second posting
I had been under the assumption that no changes have taken with the
"shapes.addpicture" command. A major change took place in XL10 and carried into XL13. First, the picture is now linked to the source (for me undesirable) and the size and position factors have changed. I have to do some studying to understand the two issues. But now that I know changes have occurred, I can tackle the problem. John |
All times are GMT +1. The time now is 12:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com