+ Reply to Thread
Results 1 to 5 of 5

Insert Page Breaks code different in Excel 2007 and 2010?

  1. #1
    Registered User
    Join Date
    04-16-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Insert Page Breaks code different in Excel 2007 and 2010?

    I have a snippet of VBA code where I insert a page break at a particular row. This works perfectly fine for me in one machine(where I have Excel 2007), but in another machine the same code doesn't insert a page break. It sounds weird to me that VBA would behave differently with different versions of Excel. Am I missing something else here?

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Insert Page Breaks code different in Excel 2007 and 2010?

    What is the code (and please use code tags when posting it) and does it cause an error on the 2010 machine, or just not do anything? (do you have a default printer installed on the 2010 machine?)
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    04-16-2010
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Insert Page Breaks code different in Excel 2007 and 2010?

    This is the snippet of code I have.

    Set ActiveSheet.HPageBreaks(2).Location = Range("A157")

    The same code works perfectly fine on a 2007 machine I have and inserts a page break.But when I try running it on 2010, I don't get an error. It simply doesn't do anything.

    And I'm sorry I didn't get what you said - did you mean add the word "code" to tags?
    Last edited by Iswarya; 04-21-2010 at 02:12 AM.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Insert Page Breaks code different in Excel 2007 and 2010?

    Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Insert Page Breaks code different in Excel 2007 and 2010?

    I've just run some tests in 2010 (probably not the version you have though) and I simply get an error every time I try to change the Location property like that. Which is odd. Of course, it may have been fixed in the final version.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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