Run time error 1004 ????

  • I've got an excel file that, on workbook open, goes to full screen, loses the command bars, status bar, etc. to make it look a bit like a 'standalone' product. I've got some navigation buttons at the time to switch between sheets. Each sheet has a worksheet_activate command to show or hide certain toolbars, etc. for example:


    Private Sub Worksheet_Activate()
    With ActiveWindow
    .DisplayGridlines = False
    .DisplayHeadings = False
    .DisplayHorizontalScrollBar = False
    .DisplayWorkbookTabs = False
    .DisplayVerticalScrollBar = True
    End With
    Application.CommandBars("Standard").Visible = False
    Application.CommandBars("Formatting").Visible = False
    Application.CommandBars("FACT Print").Visible = True
    Application.DisplayFormulaBar = False
    Application.DisplayStatusBar = False
    End Sub


    I've had no problems on a number of PCs at my office, but my client's PC is having error messages. When you click to navigate between sheets, sometimes I get "Run time error '1004', unable to set <code line&gt; property of the windows class" but not always on the same button. If I hit debug and delete the code line, I get the same message with the next line.


    I added the line 'on error resume next', which stops the error messages, but I'd like to know what the issue is.


    Thank you. (sorry for the long winded question !!!)

  • Well, until someone comes up with something better - All I can offer is an explanation (as per Microsoft) of the Error Message itself, in the hope that it helps the debugging process..



    Hope this helps

  • How do your navigate buttons work?


    Are they hyperlinks to pages that have been deleted or renamed?


    In case it is a fault with your navigation, have a look at my alternative solution on this post


    http://ozgrid.com/forum/viewthread.php?tid=1456


    Roy

  • Hi,


    I think Roy is on the right track here.


    What sort of buttons are you using to navigate between the worksheets? If you are using CommandButtons try setting the TakeFocusOnClick property to False (its True by default). Or, try using a button from the Forms toolbar instead.


    HTH

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!