+ Reply to Thread
Results 1 to 6 of 6

.Printout syntax issue

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    Illinois, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    .Printout syntax issue

    This is a syntax/beginners question:

    Im making a system to print a single cell that will contain a barcode.

    I'm writing a basic macro that uses a for loop to print cells. I'm using the cells() command to reference the test cell so I can index it by using a number. (Instead of using range() which has a LetterNumber reference.) The problem exist when I want to print the single cell. I'm trying to use .printout with cells() and I'm having an issue. Help me correct it or find something better. The code is below and a picture.



    Please Login or Register  to view this content.




    GIVE ME YOUR THOUGHTS!!
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by rhuseman; 09-21-2011 at 10:27 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Printout syntax issue

    Hi rhuseman, try
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    09-21-2011
    Location
    Illinois, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: .Printout syntax issue

    mordred,
    First of all thanks for reading this and replying. Im getting the code you submitted to not debug. Below i highlighted where its is throwing a "run time error "1004" reference not valid". Your plan of attack seems very close. I attached the workbook if thats helpful.

    ActiveSheet.PageSetup.PrintArea = Cells(cellrow, cellcollum)

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Printout syntax issue

    Replace your code with
    Please Login or Register  to view this content.
    and let me know how that goes.

  5. #5
    Registered User
    Join Date
    09-21-2011
    Location
    Illinois, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: .Printout syntax issue

    Mordred,

    The code worked. The only issue now is that it is prompt the user a window warning them that only one cell has been selected for printing and wants to know if if this is an accident. Is their a way to automatically bypass this?

    Thank you very much!

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Printout syntax issue

    Hi rhuseman, I didn't test this but the following should work
    Please Login or Register  to view this content.
    You'll notice that I set Display Alerts to False before the print statement and then set them to True after. That should take care of the alerts.

+ 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