Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default XL2007 code not working in XL2103

I have been using a VBA module for several years in XL 7 but crashes in
2013. Even when I step thru the code, it will crash about 50% of the way.
The code basically inserts 24 photos into a spreadsheet for printing. It
also includes date and photo ID. The code is attached. Please, any advice??

Sub InsertPhotosNew()
Dim Msg As String
Dim Directory As String, f As String
Dim x As Long
Dim y As Long
Dim r As Long
Dim c As Long
Dim wks As Worksheet
Set wks = ActiveSheet

Msg = "Select a location containing the files you want to list."
Directory = GetDirectory(Msg)
If Directory = "" Then Exit Sub
If Right(Directory, 1) < "\" Then Directory = Directory & "\"
ActiveSheet.Range("j1") = Directory

' Get first file
f = Dir(Directory, vbReadOnly)
r = 2
Do While f < ""
c = 1
For y = 30 To 635 Step 121
r = r + 2
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

c = c + 2

Next x
c = 1
Next y

Loop

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code OK in XL2003 but Run-time error '1004' in xl2007 Ken Johnson Excel Programming 0 July 22nd 09 01:00 PM
Programmatically removing code from ThisWorkbook XL2007 PCLIVE Excel Programming 2 February 16th 09 06:08 PM
XL2007 Pivot Table causes code to run slow? michael.beckinsale Excel Programming 3 November 3rd 08 01:13 PM
Unhide column/row shortcut keys not working in xl2007 meatshield Excel Discussion (Misc queries) 0 June 29th 07 03:37 PM
Print Preview XL2007 still not working properly Steve23 Excel Programming 1 June 27th 07 04:08 PM


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"