Get drive problem

  • Thread starter Thread starter Lillian
  • Start date Start date
L

Lillian

Hello. I am having problem with the getdrive in vba.
When I insert a Usb Flash drive it works. When I pull out the flash drive
it debugs to the getdrive line in vba.
It even debugs and ignors the on error goto err_Error_Click.

Trapping the error doesn't work for me.


Dim fsH, dH

Set dH = fsH.GetDrive("G:")
If dH.IsReady Then
run my code here
End If



Is there anyway to solve this problem?
Don't know what else to do.
 
Are you sure you're not using vbscript?
On Error Resume Next is the only Error trapping available there AFAIK.
I hope you init fsH in a way (Early / Late Binding), as there's no sign of
it in your code

Pieter
 
Pieter said:
Are you sure you're not using vbscript?
On Error Resume Next is the only Error trapping available there AFAIK.
I hope you init fsH in a way (Early / Late Binding), as there's no sign of
it in your code

Pieter


No I don't know how. I have been looking google and tried the next trapping
and nothing worked. Sometimes the next requires a for and from there I am
lost.

How do you trap the error or prevent the debug?
 
Simply

On Error Resume Next
'Code
If Err.Number<>0 Then
'Handle Error
End If

HTH

Pieter
 
That was it. It worked fine when I got everything in the right place.
Simple.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top