Results 1 to 7 of 7

Thread: Printing

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Printing

    hi
    i want to print simple text from my application .

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Printing

    Here is the simplest scenario:

    printer.print "This is sample text"
    printer.enddoc

  3. #3

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Printing

    how do i create this printer object ... is it an activeX or wat ?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Printer.Font = "Arial"
    5.     Printer.FontSize = 24
    6.     Printer.FontBold = True
    7.     Printer.ForeColor = vbBlue
    8.     Printer.Print Tab((Len("My Title") - 80) / 2); "My Title" 'Center the title and print in bold blue text
    9.     Printer.Print String(80, "-")
    10.     Printer.FontSize = 12
    11.     Printer.FontBold = False
    12.     Printer.ForeColor = vbBlack
    13.     Printer.Print "This is some that I printed."
    14.     Printer.EndDoc 'Send to print spooler for printing.
    15. 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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  5. #5
    New Member
    Join Date
    Jan 2005
    Posts
    8

    Re: Printing

    Quote 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:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Printer.Font = "Arial"
    5.     Printer.FontSize = 24
    6.     Printer.FontBold = True
    7.     Printer.ForeColor = vbBlue
    8.     Printer.Print Tab((Len("My Title") - 80) / 2); "My Title" 'Center the title and print in bold blue text
    9.     Printer.Print String(80, "-")
    10.     Printer.FontSize = 12
    11.     Printer.FontBold = False
    12.     Printer.ForeColor = vbBlack
    13.     Printer.Print "This is some that I printed."
    14.     Printer.EndDoc 'Send to print spooler for printing.
    15. End Sub
    HTH
    Thanks but how do I set the Printer? Do I need to import any class for this?

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Printing

    nothing is needed except the printer being online.

    I print to a remote printer thru a wireless lan. it works fine.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width