Run Time Error '1004'

G

Guest

A spreadsheet that is used by many different people is coming up with the
subject error now which is defined as an "Application-defined or
Object-Defined error". It gives me the chance to end or debug. When I
choose debug it takes me to code that states:

Private Sub Workbook_Open()
Sheets("Olean - Wellsville").EnableAutoFilter = True
Sheets("Olean - Wellsville").Protect contents:=True,
userInterfaceOnly:=True
End Sub

The third line is the one that it is highlighted in Yellow. I'm not versed
in VBA so I have no idea what seems to be the issue but am guessing that
somehow the syntax has been altered. Based on this limited information I
have provided, are you able to help?

I should also mention that when I open the file [Group] is appended to the
file name. I don't have any idea what that means.
 
G

Guest

Looks like maybe a linefeed problem......try combining the two lines

Sheets("Olean - Wellsville").Protect contents:=True,
userInterfaceOnly:=True

to be all on one line,...........

Vaya con Dios,
Chuck, CABGx3
 
G

Guest

I think the issue is larger but am unsure how to attack it. I rem'd out
those lines to avoid them from being executed and I was able to open up the
spreadsheet fine. I thought it was fixed so sent out a notice stating such.
Unfortunately it is still bombing on the users who are using Excel97 even
though it works for me on Excel2002. It does not even provide any error
messages for them, just quits.

I made a copy of it and deleted every sheet, every macro, and every line of
code I could find. All that was left was a new blank sheet. STILL the file
just bombs when opened in Excel97 but works fine in 2002. Any ideas on how I
could troubleshoot this?
 
D

Dave Peterson

When multiple sheets are selected, you'll see [Group] in the title bar. This
means that lots of things that lots of things you do to one sheet, you do to all
the sheets in the group.

But there are somethings that can't be done when the worksheets are
grouped--including changing protection.

You can ungroup sheets manually by just rightclicking on one of the worksheets
that are grouped (notice the background color of the worksheet tabs) and
selecting Ungroup Sheets.

In code, you can select a single sheet.

Private Sub Workbook_Open()
With Sheets("Olean - Wellsville")
.select
.EnableAutoFilter = True
.Protect contents:=True, userInterfaceOnly:=True
End With
End Sub


A spreadsheet that is used by many different people is coming up with the
subject error now which is defined as an "Application-defined or
Object-Defined error". It gives me the chance to end or debug. When I
choose debug it takes me to code that states:

Private Sub Workbook_Open()
Sheets("Olean - Wellsville").EnableAutoFilter = True
Sheets("Olean - Wellsville").Protect contents:=True,
userInterfaceOnly:=True
End Sub

The third line is the one that it is highlighted in Yellow. I'm not versed
in VBA so I have no idea what seems to be the issue but am guessing that
somehow the syntax has been altered. Based on this limited information I
have provided, are you able to help?

I should also mention that when I open the file [Group] is appended to the
file name. I don't have any idea what that means.
 

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