'How to use Shell.Application to eject a USB device on Windows XP?

I'm new to coding and I have never used Visual Basic before.

I was asked to write a script that ejects the USB drive.

Public sub cmdClose_Click()
    'CreateObject("Shell.Application").NameSpace("E:").Self.InvokeVerb "Eject"
End Sub

The above script that I found works on Windows 7 but not on XP.
If someone could give me an example of how to eject on Windows XP, that would be great.

vb6


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source