+ Reply to Thread
Results 1 to 3 of 3

printing using macro

  1. #1
    Latin Seminary
    Guest

    printing using macro

    Hi,
    I assgined a macro to a "text box" using "record new macro". This macro
    prints a certain range of cells on a laser printer.
    When I replaced the printer with a colored one: HP deskjet and run the
    macro it didn't print.
    following is the code of the macro:
    Sub TextBox1_Click()
    Range("A14:F26").Select
    With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = ""
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = ""
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0.748031496062992)
    .RightMargin = Application.InchesToPoints(0.748031496062992)
    .TopMargin = Application.InchesToPoints(0.984251968503937)
    .BottomMargin = Application.InchesToPoints(0.984251968503937)
    .HeaderMargin = Application.InchesToPoints(0.511811023622047)
    .FooterMargin = Application.InchesToPoints(0.511811023622047)
    .PrintHeadings = False
    .PrintGridlines = True
    .PrintComments = xlPrintNoComments
    .PrintQuality = 300
    .CenterHorizontally = True
    .CenterVertically = True
    .Orientation = xlPortrait
    .Draft = False
    .PaperSize = xlPaperA4
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = 100
    .PrintErrors = xlPrintErrorsDisplayed
    End With
    Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
    End Sub

    Can anyone help
    Khalil







  2. #2
    Carlos Antenna
    Guest

    Re: printing using macro

    When you record a macro it dumps all the available settings for your printer
    into the macro whether or not you made changes to that parameter. When you
    change printers this becomes a problem because some of the default settings
    on the old printer may not be available on the new one, or they may be
    simply out of range. (Does the new one print as close to the edge as the
    old one?)

    I would suggest re-recording the macro with the new printer set as the
    default.

    --Carlos

    "Latin Seminary" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > I assgined a macro to a "text box" using "record new macro". This macro
    > prints a certain range of cells on a laser printer.
    > When I replaced the printer with a colored one: HP deskjet and run the
    > macro it didn't print.
    > following is the code of the macro:
    > Sub TextBox1_Click()
    > Range("A14:F26").Select
    > With ActiveSheet.PageSetup
    > .LeftHeader = ""
    > .CenterHeader = ""
    > .RightHeader = ""
    > .LeftFooter = ""
    > .CenterFooter = ""
    > .RightFooter = ""
    > .LeftMargin = Application.InchesToPoints(0.748031496062992)
    > .RightMargin = Application.InchesToPoints(0.748031496062992)
    > .TopMargin = Application.InchesToPoints(0.984251968503937)
    > .BottomMargin = Application.InchesToPoints(0.984251968503937)
    > .HeaderMargin = Application.InchesToPoints(0.511811023622047)
    > .FooterMargin = Application.InchesToPoints(0.511811023622047)
    > .PrintHeadings = False
    > .PrintGridlines = True
    > .PrintComments = xlPrintNoComments
    > .PrintQuality = 300
    > .CenterHorizontally = True
    > .CenterVertically = True
    > .Orientation = xlPortrait
    > .Draft = False
    > .PaperSize = xlPaperA4
    > .FirstPageNumber = xlAutomatic
    > .Order = xlDownThenOver
    > .BlackAndWhite = False
    > .Zoom = 100
    > .PrintErrors = xlPrintErrorsDisplayed
    > End With
    > Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
    > End Sub
    >
    > Can anyone help
    > Khalil
    >
    >
    >
    >
    >
    >




  3. #3
    Wayman Bell
    Guest

    Re: printing using macro

    Something similar to this might work.

    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    "Carlos Antenna" <[email protected]> wrote in message
    news:[email protected]...
    > When you record a macro it dumps all the available settings for your
    > printer into the macro whether or not you made changes to that parameter.
    > When you change printers this becomes a problem because some of the
    > default settings on the old printer may not be available on the new one,
    > or they may be simply out of range. (Does the new one print as close to
    > the edge as the old one?)
    >
    > I would suggest re-recording the macro with the new printer set as the
    > default.
    >
    > --Carlos
    >
    > "Latin Seminary" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi,
    >> I assgined a macro to a "text box" using "record new macro". This macro
    >> prints a certain range of cells on a laser printer.
    >> When I replaced the printer with a colored one: HP deskjet and run the
    >> macro it didn't print.
    >> following is the code of the macro:
    >> Sub TextBox1_Click()
    >> Range("A14:F26").Select
    >> With ActiveSheet.PageSetup
    >> .LeftHeader = ""
    >> .CenterHeader = ""
    >> .RightHeader = ""
    >> .LeftFooter = ""
    >> .CenterFooter = ""
    >> .RightFooter = ""
    >> .LeftMargin = Application.InchesToPoints(0.748031496062992)
    >> .RightMargin = Application.InchesToPoints(0.748031496062992)
    >> .TopMargin = Application.InchesToPoints(0.984251968503937)
    >> .BottomMargin = Application.InchesToPoints(0.984251968503937)
    >> .HeaderMargin = Application.InchesToPoints(0.511811023622047)
    >> .FooterMargin = Application.InchesToPoints(0.511811023622047)
    >> .PrintHeadings = False
    >> .PrintGridlines = True
    >> .PrintComments = xlPrintNoComments
    >> .PrintQuality = 300
    >> .CenterHorizontally = True
    >> .CenterVertically = True
    >> .Orientation = xlPortrait
    >> .Draft = False
    >> .PaperSize = xlPaperA4
    >> .FirstPageNumber = xlAutomatic
    >> .Order = xlDownThenOver
    >> .BlackAndWhite = False
    >> .Zoom = 100
    >> .PrintErrors = xlPrintErrorsDisplayed
    >> End With
    >> Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
    >> End Sub
    >>
    >> Can anyone help
    >> Khalil
    >>
    >>
    >>
    >>
    >>
    >>

    >
    >




+ 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