I am looking to a VBA solution to send a file to a particular network printer depending on the file name.
I have a table that stores all the print choices:
Say, some of the printers are installed on my computer and are visible in the Print Dialog Box – I have no problem switching between those printers without even getting their IP addresses. I use Win API to get all the printers’ names into an array, loop through them to set them as ActivePrinter and print documents. But the headache starts when I need to send a file to a printer that is not visible on my computer. How can I manipulate printers IP addresses to print remotely – that is, get the IP from the table and send the file to that printer?
There are probably a set of API calls out there to install a printer providing you know it's IP. You could probably even manipulate the file system object to navigate the network and locate printers.
However, I would not recommend trying to do that inside Access, especially using home grown code. There are a LOT of things that can go wrong and the cost (your time, your hair, etc.) vs. benefit will be small. Not just that, but all users need to be al least "power user" to install a printer (which is what you'd have to do).
Is the network so large that you couldn't simply install all the printers you need ahead of time? If you're dealing with a large number of users, shift the responsibility for having the required printers installed to the end user (and their IT support folks).
Well... now all the needed drivers are installed on the network. And I forgot to specify that the printer table does store driver name and printer name along with a printer's IP. So what I have to do now is to select the printer's IP ( accirding to the document name in the Doc table) from the Printer table and send the document to that IP. Is it ever possible in VBA? Can I somehow use VB6 for this?