ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printer.Print Not Working? (https://www.excelbanter.com/excel-programming/357775-printer-print-not-working.html)

pike168

Printer.Print Not Working?
 

i have a command button that i am using to try and print a few things,
i have the code set up like this :

printer.print "hello world!"

but when i click the button i get the following error :

"Run-Time Error- '424'
"Object Required"

any ideas on how to fix the problem ?


--
pike168
------------------------------------------------------------------------
pike168's Profile: http://www.excelforum.com/member.php...o&userid=32986
View this thread: http://www.excelforum.com/showthread...hreadid=528922


Jim May

Printer.Print Not Working?
 
The VBA line is:
ActiveSheet.PrintOut


"pike168" wrote in
message ...

i have a command button that i am using to try and print a few things,
i have the code set up like this :

printer.print "hello world!"

but when i click the button i get the following error :

"Run-Time Error- '424'
"Object Required"

any ideas on how to fix the problem ?


--
pike168
------------------------------------------------------------------------
pike168's Profile:
http://www.excelforum.com/member.php...o&userid=32986
View this thread: http://www.excelforum.com/showthread...hreadid=528922




pike168[_2_]

Printer.Print Not Working?
 

so would the following work :

ActiveSheet.PrintOut "hello world"

because it doesnt seem to be working for m

--
pike16
-----------------------------------------------------------------------
pike168's Profile: http://www.excelforum.com/member.php...fo&userid=3298
View this thread: http://www.excelforum.com/showthread.php?threadid=52892


Dave Peterson

Printer.Print Not Working?
 
In excel, you print a range, a worksheet, or a workbook. You don't send strings
directly to the printer with .printout.

You can open the printer port and print that way, though:

Option Explicit
Sub testme01()
Open "LPT1:" For Output As #1
Print #1, "Hello world!"
Close #1
End Sub



pike168 wrote:

so would the following work :

ActiveSheet.PrintOut "hello world"

because it doesnt seem to be working for me

--
pike168
------------------------------------------------------------------------
pike168's Profile: http://www.excelforum.com/member.php...o&userid=32986
View this thread: http://www.excelforum.com/showthread...hreadid=528922


--

Dave Peterson

Jim May

Printer.Print Not Working?
 
I entered into a new Workbook - Sheet1 cell B4 "Hello world"
I then did ALT-F11 to get into VBE;
Pressing Control-G took me to the immediate window
where I typed..

Activesheet.Printout (then pressed enter)

My print then produces a single page with
Hello world (only)
OK?


"pike168" wrote in
message ...

so would the following work :

ActiveSheet.PrintOut "hello world"

because it doesnt seem to be working for me


--
pike168
------------------------------------------------------------------------
pike168's Profile:
http://www.excelforum.com/member.php...o&userid=32986
View this thread: http://www.excelforum.com/showthread...hreadid=528922




Dave Peterson

Printer.Print Not Working?
 
ps. I didn't mean to give the impression that those are the only thing that
..printout applies to. You can select printout in your code and hit F1, then the
Applies to link to see all the options.

Dave Peterson wrote:

In excel, you print a range, a worksheet, or a workbook. You don't send strings
directly to the printer with .printout.

You can open the printer port and print that way, though:

Option Explicit
Sub testme01()
Open "LPT1:" For Output As #1
Print #1, "Hello world!"
Close #1
End Sub

pike168 wrote:

so would the following work :

ActiveSheet.PrintOut "hello world"

because it doesnt seem to be working for me

--
pike168
------------------------------------------------------------------------
pike168's Profile: http://www.excelforum.com/member.php...o&userid=32986
View this thread: http://www.excelforum.com/showthread...hreadid=528922


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com