1004 runtime error

W

Waldyd

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
 
A

a7n9

Try giving explicit reference of the Workbook to the Worksheets
collection

Something like: Workbooks("1").Worksheets.Count or
Thisworkbook.Worksheets.Count
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top