Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a question regarding Error handling, or possibly writing an if
then statement to correct errors that I get when I open csv Files wit a macro. What I have is a machine that we download process logs fro that saves them in sequential order (ex. Lot0001, Lot0002, ect.). Th problem arises when only certain logs are downloaded (Ex. Lot0003 Lot0004, Lot0007). The logs in sequential order format and run fine but after skipping over the first missed log, the macro errors out. tried to put an error handler in that takes it to the next "i" on a error, but I am not sure that I did it right. I would be willing t use an if, then statement if you can check to see if the csv file i there or not, and the go to the next "i" if it is absent. Here is sample of my code, and any help is greatly appreciated! On Error GoTo Failsafe LotFile = InputBox("Enter the file folder in that contains th Logs") MyPath = "\\Shared Drive" & LotFile Before = InputBox("Enter the beginning Lot File ") After = InputBox("Enter the ending Lot File ") For i = Before To After MyFile = LotNumber & i & ".csv" SaveFile = LotNumber & i Workbooks.OpenText Filename:=MyPath & "\" & MyFile 'Code to format logs then hyperlink and and save them Failsafe: Next i End Sub Thanks again -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling - Check a file isn't already open before overwritin | Excel Discussion (Misc queries) | |||
MS Query (Excel 2007) - OLAP-Function is missing | Setting up and Configuration of Excel | |||
Disable find files error message for missing links on opening WB | Excel Discussion (Misc queries) | |||
Syntax error (missing operator) in query expression '6 Wescott Rd# | Excel Discussion (Misc queries) | |||
Error handling in vba function | Excel Programming |