From: Marc on
Hi,

I want to print only a string but I can't find the method.

My code is:

Dim s as String
Dim p As Printer

For Each p In Printers
If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
Set Printer = p
Exit For
End If
Next

s = code.Value

Printer.Print s

This last command fails.

thanks for the help.

Marc
From: Tom van Stiphout on
On Fri, 5 Mar 2010 01:50:22 -0800 (PST), Marc <negu.marc(a)gmail.com>
wrote:

I would think this does not even compile. Try this:
Dim s as String
Dim p As Printer
For Each p In Printers
If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
Exit For 'p now refers to your printer
End If
Next
s = code.Value
p.Print s 'Use this printer to print.

-Tom.
Microsoft Access MVP


>Hi,
>
>I want to print only a string but I can't find the method.
>
>My code is:
>
>Dim s as String
>Dim p As Printer
>
> For Each p In Printers
> If p.DeviceName = "\\Recepcion02\ZDesigner LP 2824" Then
> Set Printer = p
> Exit For
> End If
> Next
>
>s = code.Value
>
>Printer.Print s
>
>This last command fails.
>
>thanks for the help.
>
>Marc
From: Marc on
With your modification occurs the same problem. The line p.Print s
shows me an error that this object dont admitt this property or
method.
I'm not sure if it's posible to print a string. Maybe I have to
reserve and standard output and print like a shell.

knows somebody more from that?

thanks for the help.

Marc
From: Salad on
Marc wrote:

> With your modification occurs the same problem. The line p.Print s
> shows me an error that this object dont admitt this property or
> method.
> I'm not sure if it's posible to print a string. Maybe I have to
> reserve and standard output and print like a shell.
>
> knows somebody more from that?
>
> thanks for the help.
>
> Marc

Years ago one could do something like
Open "LPT1" For Output As #1
Print #1, "Text"
Close #1
and could write to Com1 and Com2 as well. I haven't seen those commands
used in Windows. Perhaps you could run the code from Dos but gw-basic
isn't distributed with Windows anymore...you'll have to find another
program.

Here's a link to explore if you'd like
http://mc-computing.com/Languages/SerialIO.htm

I'm not sure what the p.print s line would do. The printers collection
lets you list the printers in the collection and perhaps set the margins
and other properties of the printer object. I don't see any "print"
method or property.
From: Stuart McCall on
"Marc" <negu.marc(a)gmail.com> wrote in message
news:41acfd1d-4486-4481-81d1-475bec3615b3(a)y11g2000yqh.googlegroups.com...
> With your modification occurs the same problem. The line p.Print s
> shows me an error that this object dont admitt this property or
> method.
> I'm not sure if it's posible to print a string. Maybe I have to
> reserve and standard output and print like a shell.
>
> knows somebody more from that?
>
> thanks for the help.
>
> Marc

You can give this a try:

http://www.smccall.demon.co.uk/Downloads.htm#LinePrint

It provides character mode printing to a named printer, either local to the
pc or across the network. To incorporate it into your app, simply import the
class module and use the supplied demo to guide your coding.

hth