Results 1 to 9 of 9

Thread: {Resolved}Printing Word from VB

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    46

    Resolved {Resolved}Printing Word from VB

    i have a program that based on user inputs will populate a word template. i have this working geat. i do know how to print it, but depending on an input from the user i will need either one two or three copies. i need to do this so the user doesnt have to make the decision as some of the users are not realy computer literate. any help would be greatly appreciated.
    thanks
    Last edited by Hack; Aug 18th, 2006 at 10:38 AM. Reason: Added green "resolved" checkmark Last edited by chaser74 : Today at 10:56 AM.

  2. #2
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Printing Word from VB

    have you tried using the search facility of the forum? Im sure you'll get alot of thread answering the same question.
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  3. #3
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Printing Word from VB

    Application.PrintOut has a parameter named [Copies], add the number of copies there.

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    46

    Re: Printing Word from VB

    Here is the code i am using to print out the forms but i geta compile error everytime i run the program. any thoughts

    VB Code:
    1. If optOTC = True Or optLoaner = True Then
    2.     objWord.PrintOut.Copies = 1
    3.   ElseIf optSignal = True Then
    4.     objWord.PrintOut .Copies = 2
    5.   ElseIf optRepair = True Then
    6.     objWord.PrintOut.Copies = 3
    7.   End If

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

    Re: Printing Word from VB

    What line is the error on?

    objWord.PrintOut Copies:=3

    Should be the format.
    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

  6. #6
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    342

    Re: Printing Word from VB

    Note the [Copies] Parameter:

    VB Code:
    1. oWord.PrintOut ([Background], [Append], [Range], [OutputFileName], [From], [To], [Item], [Copies], [Pages], [PageType], [PrintToFile], [Collate], [FileName], [ActivePrinterMacGX], [ManualDuplexPrint], [PrintZoomColumn], [PrintZoomRow], [PrintZoomPaperWidth], [PrintZoomPaperHeight])

  7. #7

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    46

    Re: Printing Word from VB

    this is the code i am using now but i get a user compile error varriable not defined and it highlights the the first "COPIES=1"

    do i need to add another reference in my project as all i have now is ms word library11?


    VB Code:
    1. If optOTC = True Or optLoaner = True Then
    2.     objWord.PrintOut Copies = 1
    3.   ElseIf optSignal = True Then
    4.     objWord.PrintOut  Copies = 2
    5.   ElseIf optRepair = True Then
    6.     objWord.PrintOut Copies = 3
    7.   End If

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Printing Word from VB

    As RobDog888 points out, it could be:

    Copies:=3

    not just

    Copys = 3

  9. #9

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Nebraska
    Posts
    46

    Re: Printing Word from VB

    thanks hack that is what is was. you rock

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