View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond[_2_] Robin Hammond[_2_] is offline
external usenet poster
 
Posts: 575
Default Calling Com addin from form button on sheet?

Stephen,

I gave this another try and simply cannot get the ProgID set up against a
forms button, whether done through VBA or manually in Excel. I either get a
"Macro cannot be found" or "the formula you typed contains an error
message". I am trying to set OnAction to something like this:

!<ComAddInName.clsDesignerEventHandler

which matches exactly what I have for the commandbarbuttons. The com add in
exists and is loaded with a forms.commandbutton event handler set up and
waiting.

Any suggestions?

Robin Hammond
www.enhanceddatasystems.com

"Robin Hammond" wrote in message
...
Stephen,

Thanks for that. I thought I had tried it and I think the problem was that
I was unable to set the OnAction property for the forms button to the
ProgID at the time that I added it to the sheet, but I will give it
another try in the morning. I'll let you know what happens.

While on this subject. p334 of your book 2002 book. The parameter property
seems flaky when the event fires unless it is explicitly set. I spent a
couple of hours yesterday trying to work out why it worked, then it
didn't, having originally set just the caption. The only way I have got
the event handlers to work reliably is to explicitly set the parameter for
the commandbarbutton to the same value as the caption at the time that the
caption is set in your second code sample.

Robin Hammond
www.enhanceddatasystems.com

"Stephen Bullen" wrote in message
...
Hi Robin,

I've got command bar and menus working already, so if it is something
similar to that, I'd appreciate a few pointers.


It's exactly the same, but you need to be using the MSForms controls
(that raise events) rather than the Excel controls (that use OnAction).
You then hook up and handle the buttons' click events exactly the same
as you do for menu items (WithEvents variables etc).

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk