Results 1 to 9 of 9

VB Code working in 2010 but not 2003?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    England
    MS-Off Ver
    2016 (Mac)
    Posts
    149

    Unhappy VB Code working in 2010 but not 2003?

    Hello Everyone,

    I built a sheet in Excel 2010 that contains the following VB code:

    Private Sub Workbook_Open()
    Application.CommandBars.FindControl(ID:=2521).Enabled = False
    End Sub

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.CommandBars.FindControl(ID:=2521).Enabled = True
    End Sub
    this works fine in 2010 but now the sheet needs to run in Excel 2003. The problem
    is that when I open the sheet in 2003 I am met with the following error message:

    Run-time error '91':
    Object variable or With block variable not set

    I am just trying to disable the toolbar printer icon so that I cannot be pressed!
    In 2010 the above code fades the icon out disabling it.

    I only want the user to print using a button that has a macro attached to it already. The reason is because if they print using the print button on the toolbar every page will print! The macro that is attached to the print button that I have created will print only a specified page break range! If they print from the tool bar button 47 pages will print instead of just 1!

    Any help is much appreciated.

    Regards,

    Margate
    Last edited by Margate; 08-08-2013 at 10:50 AM. Reason: Provide more guidance in order to help find a solution.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code created in Excel 2003, not working in Excel 2010, Getting error message 400.
    By rajeshapril14 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-24-2012, 05:19 AM
  2. coding previously working in Excel 2003 version not working in Excel 2010
    By petercalbra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 10:51 AM
  3. Excel 2003 macro not working in 2010
    By davides in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-24-2012, 07:04 PM
  4. Save As not working in 2010 but worked in 2003
    By mkremeier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2012, 02:40 AM
  5. Code From 2003 to 2010 excel not working
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-20-2011, 12:41 PM

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