Set print area and print out
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Set print area and print out

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    John G
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Set print area and print out

     
    How can I set a print area from a known range and then print it. I have tried:

    Dim myrange As Range
    Workbooks(fname).Worksheets("Invoice").Activate
    Set myrange = Workbooks(fname).Worksheets("Invoice").Range("A5:L48")
    ActiveSheet.PageSetup.PrintArea = myrange.address

    This code errors out on the
    Activesheet.pagesetup.printarea = myrange.address

    John

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    John G
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I think part of my problem is that I'm trying to run this code from a userform. Any suggestions about how I can fix this?

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hi

    How are you triggering the code with assignment from a button on that userform? try adding another and reset to that script.

    Or can you not add a command button outside the sheet and test if its the userform error or is really the code.


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com