Solved

ActiveX Control Button works in Excel 2007 but not Excel 2003

Posted on 2009-05-05
7
420 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 38

Assisted Solution

by:jeverist
jeverist earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now