+ Reply to Thread
Results 1 to 9 of 9

print out based on Name Box code

  1. #1
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    print out based on Name Box code

    hi all,

    I have a problem that maybe you can help, from a combobox userform
    there are several options in the combobox,if we choose the color yellow ,print output based on the yellow area of namebox "yellow" (A1:D15)

    thanks in advance
    herukuncahyono
    Attached Files Attached Files
    Last edited by herukuncahyono; 04-13-2010 at 11:46 PM.

  2. #2
    Registered User
    Join Date
    04-09-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: print area based on Name Box code

    Good enough?...

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: print out based on Name Box code

    hi vshankaa,

    thanks for your suggestions, but I want to print out a selected area, not only set print area ( I change the title )

    thanks again
    herukuncahyono

  4. #4
    Registered User
    Join Date
    04-09-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: print out based on Name Box code

    Then you also need to add the following code..

    Please Login or Register  to view this content.

    Following is the information about PrintOut event (from Excel help)...
    Prints the object.

    expression.PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)
    expression Required. An expression that returns an object in the Applies To list.

    From Optional Variant. The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.

    To Optional Variant. The number of the last page to print. If this argument is omitted, printing ends with the last page.

    Copies Optional Variant. The number of copies to print. If this argument is omitted, one copy is printed.

    Preview Optional Variant. True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.

    ActivePrinter Optional Variant. Sets the name of the active printer.

    PrintToFile Optional Variant. True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.

    Collate Optional Variant. True to collate multiple copies.

    PrToFileName Optional Variant. If PrintToFile is set to True, this argument specifies the name of the file you want to print to.

    Remarks
    "Pages" in the descriptions of From and To refers to printed pages— not overall pages in the sheet or workbook.

    Example
    This example prints the active sheet.

    ActiveSheet.PrintOut
    Last edited by vshankaa; 04-13-2010 at 03:56 AM. Reason: Formatting...

  5. #5
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: print out based on Name Box code

    thanks for reply, but when I use the code in command button only black area selected..
    it seems the choice(combobox) is not working

    regards
    herukuncahyono
    Last edited by herukuncahyono; 04-13-2010 at 04:20 AM.

  6. #6
    Registered User
    Join Date
    04-09-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: print out based on Name Box code

    Seriously you are asking that???!!!

    Ok here it goes...
    Please Login or Register  to view this content.
    Last edited by vshankaa; 04-13-2010 at 10:37 AM. Reason: Typo

  7. #7
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: print out based on Name Box code

    hi vshankaa,
    The code is work, one more question: the code when we are working on an invisible sheet not active sheet?

    thanks in advance
    herukuncahyono

  8. #8
    Registered User
    Join Date
    04-09-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: print out based on Name Box code

    Just change ActiveSheet to Worksheets("NameoftheWorksheet").

  9. #9
    Forum Contributor
    Join Date
    03-11-2009
    Location
    Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    252

    Re: print out based on Name Box code

    vshankaa,
    thanks for your help so far,one of my problems resolved

    regards
    herukuncahyono

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1