Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ActiveX Control Button works in Excel 2007 but not Excel 2003

Posted on 2009-05-05
7
Medium Priority
?
440 Views
Last Modified: 2013-12-20
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

0
Comment
Question by:PetEdge
  • 3
  • 2
  • 2
7 Comments
 
LVL 38

Expert Comment

by:jeverist
ID: 24308164
Hi PetEdge,

Try this:

Sub find()

Application.Dialogs(xlDialogFormulaFind).Show

End Sub

Jim
0
 

Author Comment

by:PetEdge
ID: 24314430
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.
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 24314586
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Assisted Solution

by:jeverist
jeverist earned 2000 total points
ID: 24314939
PetEdge,

>  ability for the customer to leave the "Find" dialog box open

In that case I suggest that you change the command button from ActiveX to the one from the Forms toolbar.  Using the Forms command button, your original code works fine in 2003.

- Rory,

>  What is that actual error message you get in 2003?

See attached.

Jim
Sub find()
Application.CommandBars.FindControl(ID:=1849).Execute
End Sub

Open in new window

Excel-Find-Execute-Error.bmp
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 24315039
Or set the button's TakeFocusOnClick to False.
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 24315040
Thanks, Jim - I was being lazy! :)
0
 

Accepted Solution

by:
PetEdge earned 0 total points
ID: 24315534
That is the error message dialog box I receive when I try to execute the button.  

I did pose the suggestion to management that we change to a standard Forms Control, but they would prefer to keep the ActiveX (as I can change the color pallete to match our company logo and the other ActiveX buttons I have which reference the Worksheet/ActiveWorkbook/ActiveWindow all work in both versions.  

I'll try the "TakeFocusOnClick to False" option.  

Thanks for the suggestions.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question