Solved

ActiveX Control Button works in Excel 2007 but not Excel 2003

Posted on 2009-05-05
7
422 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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 article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

832 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