[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Trap and continue in Loop..

Posted on 2002-04-05
9
Medium Priority
?
165 Views
Last Modified: 2012-05-04
I have a routine that thumbnails an entire directory.
The problem is animated gifs or unsupported file types.
I cannot get this loop to continue if it bombs because of an err.number 481....
There has to be a way to increment and continue onto the next file...I have tried everything I can think of...

Public Sub SaveWholeFolder(sType As String)
For i& = 0 To frmDemo.List1.ListCount - 1
  fName$ = frmDemo.List1.List(i&)
  'On Error do what?
  frmDemo.picHidden.Picture = LoadPicture(fName$)
  Call StretchPic(frmDemo.picHidden, frmDemo.picMain)
  frmDemo.Caption = i&
  DoEvents
  x$ = Mid(fName$, InStrRev(fName$, "\") + 1)
  xx$ = Mid(x$, 1, InStr(x$, "."))
  xx$ = xx$ & sType
  Call SavePicture(frmDemo.picMain, App.path & "\Thumbnails\" & xx$)
Next i&

End Sub

Thanks
0
Comment
Question by:Form_Glow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 5

Expert Comment

by:rkot2000
ID: 6920997
on error resume next


atfer the line with possible error

if err.numnber <>0 then
  log this error
  err.clear
end if
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6920998
wouldn't something like this work?

Public Sub SaveWholeFolder(sType As String)
For i& = 0 To frmDemo.List1.ListCount - 1
 fName$ = frmDemo.List1.List(i&)
 On Error GoTo SkipMe
 frmDemo.picHidden.Picture = LoadPicture(fName$)
 Call StretchPic(frmDemo.picHidden, frmDemo.picMain)
 frmDemo.Caption = i&
 DoEvents
 x$ = Mid(fName$, InStrRev(fName$, "\") + 1)
 xx$ = Mid(x$, 1, InStr(x$, "."))
 xx$ = xx$ & sType
 Call SavePicture(frmDemo.picMain, App.path & "\Thumbnails\" & xx$)

 SkipMe:

Next i&

End Sub

0
 
LVL 5

Accepted Solution

by:
rkot2000 earned 400 total points
ID: 6921045
full solution :

Public Sub SaveWholeFolder(sType As String)
On Error resume next
For i& = 0 To frmDemo.List1.ListCount - 1
 fName$ = frmDemo.List1.List(i&)
 frmDemo.picHidden.Picture = LoadPicture(fName$)
     if err.number = 0 then
          Call StretchPic(frmDemo.picHidden, frmDemo.picMain)
           frmDemo.Caption = i&
           DoEvents
           x$ = Mid(fName$, InStrRev(fName$, "\") + 1)
           xx$ = Mid(x$, 1, InStr(x$, "."))
           xx$ = xx$ & sType
           Call SavePicture(frmDemo.picMain, App.path & "\Thumbnails\" & xx$)
     else
          err.clear
     end if    
Next i&

End Sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Form_Glow
ID: 6921076
Still bombs out at the first ani...tried all 3 solutions.........
0
 
LVL 5

Expert Comment

by:rkot2000
ID: 6921119
check you tools-options-general tab - error trapping should be set to break in class module
0
 
LVL 15

Expert Comment

by:ameba
ID: 6921125
or "Break on Unhandled Errors"
0
 
LVL 1

Author Comment

by:Form_Glow
ID: 6921163
The problem appears to be (always a file) in temp internet folder....Searching the drive the file does not exist....but my FindFiles routine is finding these strange "fake" gifs....that will always make it by the error trap...and lock the app.
0
 
LVL 17
ID: 6921185
can you call out to another routine?

Private Sub Command1_Click()
Dim ix As Integer

For ix = 1 To 100
dostuff ix
Next ix

End Sub



Private Sub dostuff(ix As Integer)
On Error GoTo handler:
'simulate error condition
If ix = 50 Then Err.Raise vbObjectError + 2002, "me", "test"
'the call that would actually generate the error
List1.AddItem ix
Exit Function
handler:
End Function
0
 
LVL 15

Expert Comment

by:ameba
ID: 6921829
Ah, yes, that error...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question