+ Reply to Thread
Results 1 to 7 of 7

PageSetup has no effect

  1. #1
    Registered User
    Join Date
    09-21-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    71

    PageSetup has no effect

    Hi everyone,

    I've recorded my changes into a macro so I hoped I'd be off the hook but it doesn't seem to have any effect. After executing the marcro, the workbook is still in portrait mode instead of landscape, and the margins are unaltered.

    The only thing I can think of at the moment, is that the macro code resides in personal.xls. Maybe that prevents the macro from altering things in other workbooks? It has to be there so that the marco is accessible to every workbook.

    Below is the Excel generated code

    cheers,

    Jeroen

    Please Login or Register  to view this content.
    Last edited by Jeroen1000; 10-02-2009 at 04:45 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: PageSetup has no effect

    Your code works on the Activesheet so provided that the sheet you are changing is actually active then the code should work on it.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-21-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    71

    Re: PageSetup has no effect

    That is probably the problem. I open a random sheet and run the macro on it.
    Hmm this does give me some ideas to try.

  4. #4
    Registered User
    Join Date
    09-21-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    71

    Re: PageSetup has no effect

    Can I somehow display the active sheet so I can make sure Excel is using the correct one and if not, change it to the correct one?

    Edit:

    I've got a lead. I executed:

    Please Login or Register  to view this content.
    And it returned that personal.xls was the active workbook and page1 the active sheet. How do I change this do the worksheet I have opened (= the worksheet that calls the macro).
    Last edited by Jeroen1000; 10-02-2009 at 04:22 AM.

  5. #5
    Registered User
    Join Date
    09-21-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    71

    Re: PageSetup has no effect

    I think the question boils down to ' is it possible to determine the workbook and sheet that has called the macro in personal.xls'.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: PageSetup has no effect

    Thisworkbook refers the workbook with the code being executed.

    Try Activeworkbook instead.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  7. #7
    Registered User
    Join Date
    09-21-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    71

    Re: PageSetup has no effect

    That indeed outputs the correct data.

    I suppose I will have to be able to change the ActiveSheet now

    My warmest thanks for helping me out (again)


    Edit: for future fellow Excel beginners:
    Please Login or Register  to view this content.
    Last edited by Jeroen1000; 10-02-2009 at 04:55 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