Bill
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Celia
Celia,
Don't know how the type showed up above but,
I've done that and it didn't work
Perhaps you can find a bug I missed:
------------------------------------------
On Error GoTo Error1
Application.CommandBars.Add (Name:="Phones").Visible = True
Application.CommandBars("Phones").Controls.Add Type:=msoControlButton, Id:= _
2950, Before:=1
Error1:
Application.CommandBars("Phones").Visible = True
On Error GoTo 0
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
------------------------------------------
Because I can sometimes open this file with
no records filtered, my solution was to filter
some programmatically and then ShowAllData.
But that way really sucks!
Bill
I don't understand.
I have just copied and pasted the final three lines of your code into a module and it worked whether or not the auto-filter was activated and whether or not the data was filtered.
Celia
Bill
The first error trap doesn't look right.
Try :-
On Error Resume Next
On Error GoTo 0
Celia
Celia,
I DO NOT doubt you.
In fact, I also copied the code to a new worksheet and produced the same results as you.
So, perhaps you might be able to locate a bug in the code as I originally suspected a problem within.
I say this because there are two TRAPS so close to another.
Bill
------------------------------------------
On Error GoTo Error1
Application.CommandBars.Add (Name:="Phones").Visible = True
Application.CommandBars("Phones").Controls.Add Type:=msoControlButton, Id:= 2950, Before:=1
Error1:
Application.CommandBars("Phones").Visible = True
On Error GoTo 0
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
------------------------------------------
Bill
I think the following works :-
Sub Macro1()
On Error Resume Next
Application.CommandBars("Phones").Visible = True
If Application.CommandBars("Phones").Visible = False Then
Application.CommandBars.Add(Name:="Phones").Visible = True
Application.CommandBars("Phones").Controls.Add Type:=msoControlButton, ID:= _
2950, Before:=1
End If
On Error GoTo 0
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
End Sub
Celia
Celia,
I think your on to something!!
I'll give it a shot...
Bill