Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

How Print

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 16 Jul 2006 19:25 GMT
In a Macro How do you print a string in a macro?

For instance: Print "Hi there" So "Hi there" goes to the printer.

I tried all kinds of things but it keeps saying someting about an
object. I'm trying to print a string variable.

Thanks

John
Dave Peterson - 16 Jul 2006 20:47 GMT
I think that most people print a worksheet (or a range on a worksheet).

So you could populate a cell with that string and then print that cell.

Range("a1").value = "hi there"
range("a1").printout

But this kind of thing would work, too:

Option Explicit
Sub testme01()
   Open "LPT1:" For Output As #1
   Print #1, "Hi There"
   Close #1
End Sub

> In a Macro How do you print a string in a macro?
>
[quoted text clipped - 6 lines]
>
> John

Signature

Dave Peterson

John - 17 Jul 2006 16:31 GMT
I have a string produced by adding strings using "&" as in "a & b & c"
When I use the Range("a1").value =, it only prints the the a of the
a&b&c.  Then it ejects the page and prints only the a of the next string
etc.

In other words... it isn't working very well.

John

> I think that most people print a worksheet (or a range on a worksheet).
>
> So you could populate a cell with that string and then print that cell.
>
> Range("a1").value = "hi there"
> range("a1").printout
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.