Macro in Excel causes problems when spreadsheet is opened in IE

A

akrosita2000

Hi!
I am having problems with an Excel spreadsheet that has couple buttons
to perform filtering functions when opened through the Internet
Explorer. The spreadsheet is a link on the website. When the end-user
clicks the link, the Excel, embedded in the IE window opens (first
asking if the end-user wants to save or open the file). Most end-users
choose to just open the file.
The spreadsheet has two buttons - to filter and to remove filter. The
reason I do not want the end-users to use the Excel filtering or find
fuctions is because the list is very large and not all of the items are
listed in the Filter drop-down box. The end-users are not too familiar
with the Excel Filter Custom function and there are too users to train.
The problem is when the user closes the file and then opens it again,
you get either of the messages: A document with the faile name
"xxx.xls" is already open. You cannot open two documents wit hteh same
name, even if the documents are in different folders OR Do you want to
save this file? thie file you are downloading cannot be opened by the
default program. It is either corrupted or it has an incorrect file
type. In both cases, the file doesn't open (the window is blank).

Below is the code for the buttons:
Sub SupplierButton()
Dim Supplier As String
Supplier = InputBox(prompt:="Enter Supplier CODE. Make sure NOT to
include SUPPLIER SUFFIX (00,01, etc). You can enter a full or partial
code. For example, entering 'Graybar' will display all bundles that
belong to 'GRAYBARELE'.")
Range("a2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="*" & Supplier & "*"
ActiveWindow.ScrollRow = 1
End Sub
Sub RemoveFilterButton()
Selection.AutoFilter Field:=1
End Sub

I found on the web that VBA doesn't work well in a spreadsheet that's
embedded in the IE, but couldn't track the solution.

Any suggestions?

Thank you in advance!
 

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