Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application.ActivePrinter Question

Status
Not open for further replies.

Gerbers404

Programmer
Jun 11, 2001
84
US
Hello, has the nature of how to change the active printer changed recently? I have a little XL macro that selects a lable printer, prints some data to it, and then supposedly resets the active printer to the normal default shared printer/copier. Unfortunately, this no longer happens.
I wrote the code to set the Application.ActivePrinter to a string variable that contains the proper string for the lable printer. As I step through the code, though I do assign that variable to the ActivePrinter property, it does not accept it and keeps the path for the default printer. Has something changed that I am not aware of?

Any ideas would be appreciated. Thank you.

Gerbers404
 
It could be a code problem, although without seeing the code it's hard to say. It sounds more like the printer path you are specifying is no longer valid for some reason. Could the path itself have changed somehow? Try another valid printer path (if you have a third printer) to see if that works.

VBAjedi [swords]
 
I think the code should be fine, and I also thought the path was not valid anymore. It doesn't really make any sense though... The label printer is a local printer tied to the comm port on the machine... nothing has changed as far as OS or XL versions as far as I'm aware. The only thing that has changed is the physical location of the machine (we are in the middle of moving to a new facility). Thanks for your help. Will continue digging into it.
 
Maybe when the machine was set back up after the move someone plugged the printer into a different com port than it used to be? (if you have multiple com ports). Just a thought. . .

VBAjedi [swords]
 
Are you able to select the printer and print the labels manually? After doing so, check the activeprinter property, and make sure it's the same as the string you are assigning to it in code.
Rob
[flowerface]
 
Hey! That was a good, common sense idea :) It actually brought the probelm to light.... the printer says it was printing to lpt1 instead of the com port I have it hooked to... I changed the path to lpt1 and it started working.. Still don't understand why, at it is actually a com port that it's using, but at least we are fixed for what we needed. Thank you!

Gerbers404
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top