|
-
Jan 31st, 2005, 10:05 AM
#1
Thread Starter
Addicted Member
Printing
hi
i want to print simple text from my application .
-
Jan 31st, 2005, 10:09 AM
#2
PowerPoster
Re: Printing
Here is the simplest scenario:
printer.print "This is sample text"
printer.enddoc
-
Jan 31st, 2005, 01:18 PM
#3
Thread Starter
Addicted Member
Re: Printing
how do i create this printer object ... is it an activeX or wat ?
-
Jan 31st, 2005, 02:05 PM
#4
Re: Printing
The printer object is a default object in the default vb project. You can easily
change the Font, size, color, position, etc. Just type like previously posted or...
VB Code:
Option Explicit
Private Sub Command1_Click()
Printer.Font = "Arial"
Printer.FontSize = 24
Printer.FontBold = True
Printer.ForeColor = vbBlue
Printer.Print Tab((Len("My Title") - 80) / 2); "My Title" 'Center the title and print in bold blue text
Printer.Print String(80, "-")
Printer.FontSize = 12
Printer.FontBold = False
Printer.ForeColor = vbBlack
Printer.Print "This is some that I printed."
Printer.EndDoc 'Send to print spooler for printing.
End Sub
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 1st, 2005, 02:42 PM
#5
New Member
Re: Printing
 Originally Posted by RobDog888
The printer object is a default object in the default vb project. You can easily
change the Font, size, color, position, etc. Just type like previously posted or...
VB Code:
Option Explicit
Private Sub Command1_Click()
Printer.Font = "Arial"
Printer.FontSize = 24
Printer.FontBold = True
Printer.ForeColor = vbBlue
Printer.Print Tab((Len("My Title") - 80) / 2); "My Title" 'Center the title and print in bold blue text
Printer.Print String(80, "-")
Printer.FontSize = 12
Printer.FontBold = False
Printer.ForeColor = vbBlack
Printer.Print "This is some that I printed."
Printer.EndDoc 'Send to print spooler for printing.
End Sub
HTH
Thanks but how do I set the Printer? Do I need to import any class for this?
-
Feb 1st, 2005, 03:09 PM
#6
Re: Printing
nothing is needed except the printer being online.
I print to a remote printer thru a wireless lan. it works fine.
-
Feb 1st, 2005, 03:11 PM
#7
Re: Printing
You can iterate through the Printers collection and set it to one you need if the
one you need is not the default printer.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|