+ Reply to Thread
Results 1 to 5 of 5

F8 works but F5 doesn't for print settings

  1. #1
    Registered User
    Join Date
    05-28-2013
    Location
    Limassol, Cyprus
    MS-Off Ver
    Excel 2010
    Posts
    3

    F8 works but F5 doesn't for print settings

    Hi,

    I've just registered with Excel forum so this is my first thread.

    I've been a user of excel vba for some time now and it is the first time I come accross this problem.

    I am importing a file into an excel 'database' and after the formating, I set up my print settings (header, footer, zooming etc). For some strange reason everything works fine when I step into the macro with F8 but the header and footer doesn't work when I run the macro with F5.

    Has anybody come across this problem?

    Thanks
    Costas

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: F8 works but F5 doesn't for print settings

    When you step over using F8, there is no error with the syntax, but the code does not do what is intended to do.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Can we see the code?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    05-28-2013
    Location
    Limassol, Cyprus
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: F8 works but F5 doesn't for print settings

    ' PRINT SETUP
    Application.PrintCommunication = False
    ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
    "C:\Users\costasp\Pictures\Logo colour.jpg"
    With ActiveSheet.PageSetup.LeftHeaderPicture
    .Height = 17.25
    .Width = 66
    End With
    With ActiveSheet.PageSetup
    .PrintTitleRows = "$1:$1"
    .PrintTitleColumns = "$A:$B"
    .PrintArea = "A1:O" & MyTotalsRow
    End With
    With ActiveSheet.PageSetup
    .LeftHeader = "&G"
    .CenterHeader = "&""Arial,Bold""&14" & MyText
    .RightHeader = "&""Arial,Normal""&10Printed on &D@&T" & Chr(10) & "Page &P of &N"
    .LeftFooter = "&""Arial,Normal""&9&Z&F - &A"
    .CenterFooter = ""
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0.196850393700787)
    .RightMargin = Application.InchesToPoints(0)
    .TopMargin = Application.InchesToPoints(0.78740157480315)
    .BottomMargin = Application.InchesToPoints(0.47244094488189)
    .HeaderMargin = Application.InchesToPoints(0.196850393700787)
    .FooterMargin = Application.InchesToPoints(0)
    .PrintHeadings = False
    .PrintGridlines = True
    .PrintComments = xlPrintNoComments
    .PrintQuality = 600
    .CenterHorizontally = True
    .CenterVertically = False
    .Orientation = xlLandscape
    .Draft = False
    .PaperSize = xlPaperA4
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = 63
    .PrintErrors = xlPrintErrorsDisplayed
    .OddAndEvenPagesHeaderFooter = False
    .DifferentFirstPageHeaderFooter = False
    .ScaleWithDocHeaderFooter = True
    .AlignMarginsHeaderFooter = False
    .EvenPage.LeftHeader.Text = ""
    .EvenPage.CenterHeader.Text = ""
    .EvenPage.RightHeader.Text = ""
    .EvenPage.LeftFooter.Text = ""
    .EvenPage.CenterFooter.Text = ""
    .EvenPage.RightFooter.Text = ""
    .FirstPage.LeftHeader.Text = ""
    .FirstPage.CenterHeader.Text = ""
    .FirstPage.RightHeader.Text = ""
    .FirstPage.LeftFooter.Text = ""
    .FirstPage.CenterFooter.Text = ""
    .FirstPage.RightFooter.Text = ""
    End With
    Application.PrintCommunication = True

  5. #5
    Registered User
    Join Date
    05-28-2013
    Location
    Limassol, Cyprus
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: F8 works but F5 doesn't for print settings

    Reply for AB33.

    The code does exactly what it is intended to do when stepping into it but doesn't when I run it. That's why it is very strange.
    Last edited by CostasP; 05-28-2013 at 11:51 AM.

+ 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