PDA

View Full Version : VBA code to find shares on a server



InLaNoche
06-18-2012, 01:53 PM
Hello all. First post here, and relatively new to VBA. I am posting here because my code is part of some VBA scripts for a Visio 2007 map drawing. I can go into more detail if needed, but basically I am trying to do some quick printer installs from the floor map I have. Installation code is there, no problem. I am hoping to make the process of getting that info a bit easier on the staff maintaining the Visio diagram (that pulls data from an Access database, but again, that side is fine).

I have the server name, for instance:
serv-1.
We often have 2 to 4 queues for our printers here (don't ask...), but the queue for each printer has a set name prefix. Generally for a printer (let's say it's called Prn) with a PCL and PS queue, the name would be something like:
Prn_PCL
Prn_PS
The name Prn is in the database already. So what I need to do is check serv-1 for shares that begin with Prn. Hopefully this can be done and passed back to a string, in which I could add seperators (;) or just make a string array. Once I can do this, the rest is handled, as right now I manually enter (as shape data) the path to install the printer queue (such as \\ serv-1 \ Prn_PCL) - had to space it so it didn't create a link...

Is this doable, or should I just let it go?