Solved

ActiveX Control Button works in Excel 2007 but not Excel 2003

Posted on 2009-05-05
7
431 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

615 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