+ Reply to Thread
Results 1 to 2 of 2

Workbook_BeforePrint causes runtime 1004 error only on chart tab

  1. #1
    Registered User
    Join Date
    08-31-2011
    Location
    Virginia, USA
    MS-Off Ver
    Excel 2003/Excel 2007
    Posts
    37

    Workbook_BeforePrint causes runtime 1004 error only on chart tab

    I am working on setting up a footer that can't be changed. The code I used is
    Please Login or Register  to view this content.
    (Courtesy of a previous thread)

    This works perfectly for all my tabs except the Chart that is created by a macro. When I test the above code for that tab by using print preview, I get "Run-time error '1004': Unable to set the LeftFooter property of the PageSetup class"

    The chart is made using the following code

    Please Login or Register  to view this content.
    Doing some investigating, the cause of the error is supposed to be not having a default printer set-up. I am stuck because I do have a default printer set-up; more confusing for me is that the first code works on every single tab in the workbook EXCEPT the chart. The chart has the same level of protection set as several of the other tabs also; the larger macro handles the protection for the sheets.

    Any thoughts on what is triggering the error or what else to check would be greatly appreciated. Thank you.

  2. #2
    Registered User
    Join Date
    08-31-2011
    Location
    Virginia, USA
    MS-Off Ver
    Excel 2003/Excel 2007
    Posts
    37

    Re: Workbook_BeforePrint causes runtime 1004 error only on chart tab

    I've also tried different types of printers while troubleshooting this. I was testing by printing to CutePDF; I also tried having my default set to an actual printer. I was sure it shouldn't matter but I figured I would rule it out.

    I also tried working backwards through the macro that makes the plot. I tried removing the original graph footer created in the make a plot macro, didn't help.

    If I leave the graph on the tab it is created in and do print preview (with the spreadsheet data still visible behind the graph), the beforeprint footer DOES show up. If I just select the graph for print preview, the beforeprint footer DOES NOT show up. But neither do I get the runtime error in this case. Is it possible what I am seeing is just how Excel handles the beforeprint event for a graph?

+ 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