View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
SteveDB1 SteveDB1 is offline
external usenet poster
 
Posts: 414
Default modification of auto-multiple workbook macro, Ron DeBruin (Cop

Hi Ron,

Actually, I do want to "update" all of my xl* files.

The problem goes back to having processed some files, and then if I get hung
up on some error, it requires that I restart all over again.

Errors I can deal with, but starting over each time I get yet another error
is killing my time.

I need to be able to pick up where I left off, and move forward.

What would it take to modify this so that I don't need to start from scratch
each time I hit a bug/error?



"Ron de Bruin" wrote:

Hi Steve

Do not change Fnum

If you only want to run the macro on the xls files then change this line

FilesInPath = Dir(myPath & "DTR*.xl*")

to
FilesInPath = Dir(myPath & "DTR*.xls")



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"SteveDB1" wrote in message ...
Hi Ron,
After I made the modifications to your copy4 macro, I've found the
following-- code first, then issue.
----------------------------------------------------
Dim myPath As String, FilesInPath As String
Dim MyFiles() As String, Fnum As Long
Dim myBook As Workbook


myPath = "S:\Assignments - Final\Truckee River Claims\"

FilesInPath = Dir(myPath & "DTR*.xl*")
If FilesInPath = "" Then
MsgBox "No Files Found"
Exit Sub
End If

Fnum = 0
Do While FilesInPath < ""
Fnum = Fnum + 1
ReDim Preserve MyFiles(1 To Fnum)
MyFiles(Fnum) = FilesInPath
FilesInPath = Dir()
Loop

If Fnum 0 Then
For Fnum = LBound(MyFiles) To UBound(MyFiles)
Set myBook = Nothing
On Error Resume Next
Set myBook = Workbooks.Open(myPath & MyFiles(Fnum))
On Error GoTo 0
Call ASaveNewFormat
Next Fnum
End If

End Sub
---------------------------------------------------
I have two primary issues.
1- This requires me to process all of the files in my directory, and I do
not want to re-process them, once I've done so if I get caught up in an
error.
As such, I tried changing the starting number of Fnum. I think that this is
where my error is stemming from, because it worked fine before I changed the
start # for Fnum.
2- How can I keep it from starting out at 0, and actually start at the file
number of my choosing, in the event I find that there is a file that the
routine will not process?
Thank you.