+ Reply to Thread
Results 1 to 2 of 2

VBA Application Event - BeforePrint

  1. #1
    Registered User
    Join Date
    10-21-2009
    Location
    Houston
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA Application Event - BeforePrint

    I've exhausted my searches trying to bang this out, when I know I can solve my probably in an un-sexier manor by creating a macro that overrides CTRL+P to run spell check and then print. However, I am hell-bent on figuring this thing out.

    My goal: to force excel to run spell check before I print, or in my current code, give me the option to

    Status: Everything in my code works, except for the fact that I cannot get it to work at the application level. That means, the macro is written in personal.xls and works with personal.xls if i try print out of personal.xls. It also works in other workbooks, but here is the rub. If i close out of everything and restart excel, it does not work with other workbooks unless I unhide personal.xls, print from there (bringing up the spell check/print process), and then move back to the other workbook where it begins working for that workbook and any other...until I close and reopen excel again.

    Here is how I coded it:

    Class Module "Class1" of personal.xls

    Please Login or Register  to view this content.
    Then, in "ThisWorkbook" on personal.xls

    Please Login or Register  to view this content.
    Again, this all works outside of getting it recognize the code each time I start excel. I may not be saying that right, but then again, there is likely plenty that I'm not doing right.

    Thanks in advance

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

    Thumbs down Re: VBA Application Event - BeforePrint

    Surely you need to put the code in the Workbook open event of the personal workbook.
    That way the class object can listen for events within the app.

    Currently you have it so the class will be created when you print the personal workbook, which I guess you never do.

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

+ 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