Turn on/off the light attached to usb port through VBA

MBMSOFT

Registered User.
Local time
Today, 01:08
Joined
Jan 29, 2010
Messages
90
Enable and disable usb port ....
Is it possible enable and disable a usb port via vba?

An example of using this would be if I had a light plugged in a usb port and the code would turn it on and off.

Or maybe is there s some device like <PC-Some Device-USB light > which can be controled by vba
Thanks
 
Last edited:
I don't think you could do it directly, however you could indirectly with something like an Arduino Nano. You would have to download some code onto the Nano and you would need some software on the PC I think you can Python. I did it with some software code "Processing" (I think that was its name)
 
Not unless you find a library in the references that has the right objects for manipulating device controllers.

But the easiest thing (if you really want to use VBA) is to look for a cmd command that does it and run it via the VBA.Shell() command. And I think that using WMI you can get the USB port names. However, I think that Powershell would be better for this sort of thing so consult the right forums.
 
I brought myself an Arduino Nano from China and had a play with it 6 months or so ago. At the time I did some videos basically for my own use; to remind me of how and what I had done; not really of a quality to publish on the internet. However I have just had a look at them and I think they actually convey the message quite well so I put them into a playlist on YouTube which you can watch yourself here:-

https://www.youtube.com/playlist?list=PLhf4YcS5AjdoeslV-hSJu3HiqhNnAWncX

The first two videos explain,... basically how it's done (with some info gaps actually) you would need some more information to do this yourself. The last 2 videos are recordings of the LED's flashing on and off; these two videos are used in the first two videos. I included them in the Play List because you can see the "loss of LED flashes" in the recording "of THE recording".... which is an interesting thing to note in itself....
 

Users who are viewing this thread

Back
Top Bottom