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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use PrintOut ?

Status
Not open for further replies.

ainkca

Programmer
Aug 26, 2002
111
0
0
CA
Hi all,

Can someone maybe tell me what I've done wrong below? I thought I had the coding right, but when I specify the path and specify a printer name I get "Run-time error 10, Unable to print the document."

I thought I had the VB correct?

Private Sub Document_Open()
Dim Doc As Document
Set Doc = Application.Documents.Item(1)
Doc.Refresh
Doc.Save
Doc.PrintOut ("\\Path to Our Server\Our Printer")
Application.Quit
End Sub

Any thoughts? My ultimate goal is to NOT specify the printer at all, but rather have it print to whichever printer is set as the default.

Running BO 5.1.2 in a Citrix environment on NT servers.

 
You must specify the name of a printer installed on your machine. You cannot specify an arbitrary net printer.

So, install "\\Path to Our Server\Our Printer" in your machine (browse to it, right click it and select "Install"). After installing it, you will have a new printer on the "Control Panel\Printers" folder. Use the name of that printer as the argument to PrintOut().
 
What if that printer is already in my printers folder?

 
Use the name of that printer as it's shown in the "Control Panel\Printers" folder, not the original net printer name.
 
This is what I tried, like you suggested. I still get the error though. Do you think it could be related to the THIN(Citrix) environment? We've got 5 NT servers we use for load balancing our users. Most users have to reset their default printer each time they log in. I'm one of the few who don't. I was hoping to find a way to do this so I didn't have to specify an exact printer... so for example a user who moves from place to place could print a report from wherever. If I hard code the printer, then they'll have to always go to that printer to get the document. We're across 3 sites, and one of them is 20 miles away.

Private Sub Document_Open()

Dim Doc As Document

Set Doc = Application.Documents.Item(1)
Doc.Refresh
Doc.Save
Doc.PrintOut ("PGC_TEAMRM1 on ckha24")
Application.Quit

End Sub
 
ainkca,
not a directly reply to your problem but the default printers dropping out is a Citrix Bug to do with profiles being held on servers, if you contact the Citrix support team they will be able to give you a software patch that will stop the problem.

You can find the default printer name automatically and set it to a system variable. This could then be used in your vb code.


 
Thanks for the info. I actually knew about Citrix dropping the default printer when a user logs out. For the most part, it's been corrected by our tech guys with whatever magic they used (probably the patch you're talking about). Still, our users know to always select a default printer, because we had to for so long.
Unfortunately, even WITH a default printer selected it doesn't work. And it doesn't want to work when I specify it either.
I did get it to work twice... and nothing has changed. Must have just been holding my tongue right.
How would I automatically get the default printer and set it as a variable? (I know how to do the variable part)
Thanks,
ainkca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top