VBA Autofilter error in '97, not 2000

  • Thread starter Thread starter Foggy
  • Start date Start date
F

Foggy

I have a VBA Excel macro which runs happily in Office 2000 but falls
over with the 1004 error ("Autofilter method of Range Class Failed")
in Office 97 (SR 2)

The code in question is
Sheets(3).Range("A4")..AutoFilter , _
field:=7, _
Criteria1:= "*Open*"

This works fine in Office 2000, but all users still using Office 97
report this error (tried both NT and W2K OS's)
I have tried the MS KB and have trawled the web and usenet for a
couple of days now but I have found no solution.
Can anyone help?
TIA

Foggy
 
Whenever I see the 1004 error with words that say it worked in xl2k, but not
xl97, I think of code being run from a control on the worksheet from the
ControlToolbox toolbar. (Like a commandbutton).

If that describes your situation, then try changing the .takefocusonclick
property of that control to False.

If the control you're using doesn't have that property, then add this line near
the top of your code:

activecell.activate
 
Whenever I see the 1004 error with words that say it worked in xl2k, but not
xl97, I think of code being run from a control on the worksheet from the
ControlToolbox toolbar. (Like a commandbutton).

If that describes your situation, then try changing the .takefocusonclick
property of that control to False.

If the control you're using doesn't have that property, then add this line near
the top of your code:

activecell.activate

Thanks for this, but I have already tried it.
The problem occurs in two places.
Firstly in the Workbook_Open event and then later as a result of
comboboxes on the actual sheet.
Any further help is appreciated.

Foggy
 
I don't have a next guess.

You may want to post a few more lines of code.
 

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

Back
Top