+ Reply to Thread
Results 1 to 2 of 2

[SOLVED] 1004 runtime error

  1. #1
    Waldyd
    Guest

    [SOLVED] 1004 runtime error

    Hi...

    I saved an Excel Application as Microsoft Excel Complement and when i
    started the Application, the followin was prompt:

    1004 runtime error
    Error in 'Worksheets' method of '_Global' Object

    Here is the code causing the error

    Sub Auto_open()


    'Modificacion de la GUI de Excel
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Application.DisplayStatusBar = False
    Application.CommandBars("Standard").Visible = False
    Application.CommandBars("Formatting").Visible = False
    Application.CommandBars("Drawing").Visible = False
    Application.DisplayFormulaBar = False


    For i = 1 To Int(Worksheets.Count) 'This line is causing the error

    Worksheets(i).Activate
    With ActiveWindow
    .DisplayGridlines = False
    .DisplayHeadings = False
    .DisplayHorizontalScrollBar = False
    .DisplayVerticalScrollBar = False
    .DisplayWorkbookTabs = False
    End With

    Next i

    Sheets(1).Select
    Range("A44").Select
    ActiveWindow.ScrollRow = 1

  2. #2
    Registered User
    Join Date
    03-04-2006
    Posts
    20
    Try giving explicit reference of the Workbook to the Worksheets collection

    Something like: Workbooks("1").Worksheets.Count or Thisworkbook.Worksheets.Count
    All that we are is the result of what we have thought; what we think we become- Buddha
    My Home page My Excel/VBA Blog

+ 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