Get drive problem

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.
 
P

Pieter Wijnen

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
 
L

Lillian

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?
 
P

Pieter Wijnen

Simply

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

HTH

Pieter
 
L

Lillian

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

Top