Link to home
Create AccountLog in
Avatar of PetEdge
PetEdgeFlag for Afghanistan

asked on

ActiveX Control Button works in Excel 2007 but not Excel 2003

I have an ActiveX Command Button I created in an Excel 2007 spreadsheet to execute the "Find" function.  The button will be used by customers to find a product on an order form.  The problem is that the code tied to the button works great in Excel 2007 but gives an error message if you try clicking the button in 2003.    

How can I make it function in both versions ?

Thanks in advance for any help.
Sub find()
Application.CommandBars.FindControl(ID:=1849).Execute
End Sub

Open in new window

Avatar of jeverist
jeverist
Flag of United States of America image

Hi PetEdge,

Try this:

Sub find()

Application.Dialogs(xlDialogFormulaFind).Show

End Sub

Jim
Avatar of PetEdge

ASKER

Thanks Jim for the response.  

This does work in both versions of Excel but what I've now lost is the ability for the customer to leave the "Find" dialog box open while they update quantities on the order form.  

Are there any other commands/options that might return the functionality in my original code?

Here's the strangest thing that maybe someone can address...

If I execute my original code from the VB window in either version of Excel, the "Find" dialog box appears, it's only when I click the button I created in 2007 that doesn't bring up the pop-up in 2003.  

Thanks.
So does your button's click event simply call the find sub then? What is that actual error message you get in 2003?
Regards,
Rory
SOLUTION
Avatar of jeverist
jeverist
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Or set the button's TakeFocusOnClick to False.
Thanks, Jim - I was being lazy! :)
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.