|
From: Rick Raisley on 7 Jul 2008 14:53 Well, this is pretty weird. Now this code works perfectly in the IDE: On Error Resume Next a$ = Dir$(Drive$ & "*.tif") Do While a$ > "" Kill Drive$ & a$ a$ = Dir$ Loop I'm pretty darn certain that's what I had before. But either it isn't, or something's inconsistent. One thing that might have had a bearing at some point during my testing is that my FileExists function had two statements at the beginning: If DebugIt% then On Error Resume Next On Error Resme Next Yes, I know they're redundant. I have a habit of using the "If DebugIt.." statement at the beginning of much of my code, and set global variable DebugIt% = True, except when running in the IDE (wrong naming, I know). This lets me look for errors that occur that I'm not expecting while in the IDE, but cover things up more easily when compiled. Anyhow, I'm wondering if the first statement If Debug% being False in the Function somehow changed the way error handling was handled in the main code Sub? I don't know. It makes no sense to me now, except that now the code works as I originally expected. I guess a simple: On Error Resume Next Kill Drive$ & "*.tif" would have worked as well, until it found the first file it couldn't delete, but the above code is obviously better. Anyhow, thanks again for all the help, guys. ;-) -- Regards, Rick Raisley heavymetal-A-T-bellsouth-D-O-T-net
From: dpb on 7 Jul 2008 15:06 Rick Raisley wrote: .... > point during my testing is that my FileExists function had two statements at > the beginning: > > If DebugIt% then On Error Resume Next > On Error Resme Next > .... > ... Anyhow, I'm wondering if the > first statement If Debug% being False in the Function somehow changed the > way error handling was handled in the main code Sub? Why don't you put it back in and test it and find out??? --
From: Rick Raisley on 7 Jul 2008 16:24 "dpb" <none(a)non.net> wrote in message news:g4tpjt$2pm$1(a)aioe.org... > Rick Raisley wrote: > ... >> point during my testing is that my FileExists function had two statements >> at the beginning: >> >> If DebugIt% then On Error Resume Next >> On Error Resme Next >> > ... >> ... Anyhow, I'm wondering if the first statement If Debug% being False in >> the Function somehow changed the way error handling was handled in the >> main code Sub? > > Why don't you put it back in and test it and find out??? > Too logical. lol! Kidding. I tried it, and couldn't get it to cause an error again. I'll chalk it up to Monday, as at least I have a working program now. ;-) -- Regards, Rick Raisley heavymetal-A-T-bellsouth-D-O-T-net
From: Henning on 7 Jul 2008 18:18 "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> skrev i meddelandet news:%23G$8oLG4IHA.1200(a)TK2MSFTNGP04.phx.gbl... > Well, this is pretty weird. Now this code works perfectly in the IDE: > > On Error Resume Next > a$ = Dir$(Drive$ & "*.tif") > Do While a$ > "" > Kill Drive$ & a$ > a$ = Dir$ > Loop > > I'm pretty darn certain that's what I had before. But either it isn't, or > something's inconsistent. One thing that might have had a bearing at some > point during my testing is that my FileExists function had two statements > at the beginning: > > If DebugIt% then On Error Resume Next > On Error Resme Next > > Yes, I know they're redundant. I have a habit of using the "If DebugIt.." > statement at the beginning of much of my code, and set global variable > DebugIt% = True, except when running in the IDE (wrong naming, I know). > This lets me look for errors that occur that I'm not expecting while in > the IDE, but cover things up more easily when compiled. Anyhow, I'm > wondering if the first statement If Debug% being False in the Function > somehow changed the way error handling was handled in the main code Sub? > > I don't know. It makes no sense to me now, except that now the code works > as I originally expected. I guess a simple: > > On Error Resume Next > Kill Drive$ & "*.tif" > > would have worked as well, until it found the first file it couldn't > delete, but the above code is obviously better. > > Anyhow, thanks again for all the help, guys. ;-) > > -- > Regards, > > Rick Raisley > heavymetal-A-T-bellsouth-D-O-T-net > > Why are you setting an Integer to 0, 1, True?? /Henning
From: Rick Raisley on 7 Jul 2008 21:21
"Henning" <computer_hero(a)coldmail.com> wrote in message news:48729630$0$12245$57c3e1d3(a)news3.bahnhof.se... > > "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> skrev i meddelandet > news:%23G$8oLG4IHA.1200(a)TK2MSFTNGP04.phx.gbl... >> Well, this is pretty weird. Now this code works perfectly in the IDE: >> >> On Error Resume Next >> a$ = Dir$(Drive$ & "*.tif") >> Do While a$ > "" >> Kill Drive$ & a$ >> a$ = Dir$ >> Loop >> >> I'm pretty darn certain that's what I had before. But either it isn't, or >> something's inconsistent. One thing that might have had a bearing at some >> point during my testing is that my FileExists function had two statements >> at the beginning: >> >> If DebugIt% then On Error Resume Next >> On Error Resme Next >> >> Yes, I know they're redundant. I have a habit of using the "If DebugIt.." >> statement at the beginning of much of my code, and set global variable >> DebugIt% = True, except when running in the IDE (wrong naming, I know). >> This lets me look for errors that occur that I'm not expecting while in >> the IDE, but cover things up more easily when compiled. Anyhow, I'm >> wondering if the first statement If Debug% being False in the Function >> somehow changed the way error handling was handled in the main code Sub? >> >> I don't know. It makes no sense to me now, except that now the code works >> as I originally expected. I guess a simple: >> >> On Error Resume Next >> Kill Drive$ & "*.tif" >> >> would have worked as well, until it found the first file it couldn't >> delete, but the above code is obviously better. >> >> Anyhow, thanks again for all the help, guys. ;-) >> >> -- >> Regards, >> >> Rick Raisley >> heavymetal-A-T-bellsouth-D-O-T-net >> >> > > Why are you setting an Integer to 0, 1, True?? > Why not? Boolean is too hard to spell. And in the case of this function, I thought I might use True to mean the file can be written to, False/0 to mean it does not exist, and 1 to mean that it exists, but cannot be written to. -- Regards, Rick Raisley |