 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
David Hoyle Guest
|
Posted: Fri Sep 01, 2006 7:38 pm Post subject: Excel 2000 COM Addins |
|
|
I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and wished
to do the same thing but every attempt to add a new menu to the existing
"Worksheet Menu bar" commandbar is met with the exception "The parameter is
incorrect". I've looked for solution in these newsgroups and other but
no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection and
Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise would
be most grateful (The addin is coded and works, i.e. loads in Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle |
|
| Back to top |
|
 |
Eugene E. Starostin Guest
|
Posted: Fri Sep 01, 2006 8:46 pm Post subject: Re: Excel 2000 COM Addins |
|
|
Hello David,
Please have a look at http://www.add-in-express.com/add-in-delphi/
It is our product, Add-in Express, that can help you to avoid a lot of
pitfalls in different versions of Office.
--
Regards from Belarus,
Eugene E. Starostin
---
http://www.add-in-express.com - steroids for Office developers
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f845ba (AT) newsgroups (DOT) borland.com...
| Quote: | I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and
wished to do the same thing but every attempt to add a new menu to the
existing "Worksheet Menu bar" commandbar is met with the exception "The
parameter is incorrect". I've looked for solution in these newsgroups and
other but no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection
and Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise would
be most grateful (The addin is coded and works, i.e. loads in Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle
|
|
|
| Back to top |
|
 |
David Hoyle Guest
|
Posted: Fri Sep 01, 2006 11:28 pm Post subject: Re: Excel 2000 COM Addins |
|
|
Thank Eugene,
I did stumble across your web site earlier this week.
One thing I should mention is that all my software is free, so I don't tend
to invest in component sets / IDE Addins, I rather build things myself (it
took me 6 years to upgrade from D5 to 2006).
Evidently it can be done, I just need to find the information.
regards
Dave.
--
regards
David Hoyle
"Eugene E. Starostin" <eestar nospam at afalinasoft dot com> wrote in
message news:44f85551 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello David,
Please have a look at http://www.add-in-express.com/add-in-delphi/
It is our product, Add-in Express, that can help you to avoid a lot of
pitfalls in different versions of Office.
--
Regards from Belarus,
Eugene E. Starostin
---
http://www.add-in-express.com - steroids for Office developers
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f845ba (AT) newsgroups (DOT) borland.com...
I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and
wished to do the same thing but every attempt to add a new menu to the
existing "Worksheet Menu bar" commandbar is met with the exception "The
parameter is incorrect". I've looked for solution in these newsgroups and
other but no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection
and Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise
would be most grateful (The addin is coded and works, i.e. loads in
Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle
|
|
|
| Back to top |
|
 |
David Hoyle Guest
|
Posted: Fri Sep 01, 2006 11:56 pm Post subject: Re: Excel 2000 COM Addins |
|
|
Eugene,
I've downloaded a 30 day trial of your software from CodeCentral. It seem
obvious that you can create a new CommandBar (which I could do anyway) but
does not seem obvious if you can add to an existing CommandBar. Can your
components do this, if not I'm back in the same boat I was in before.
regards
David Hoyle
"Eugene E. Starostin" <eestar nospam at afalinasoft dot com> wrote in
message news:44f85551 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello David,
Please have a look at http://www.add-in-express.com/add-in-delphi/
It is our product, Add-in Express, that can help you to avoid a lot of
pitfalls in different versions of Office.
--
Regards from Belarus,
Eugene E. Starostin
---
http://www.add-in-express.com - steroids for Office developers
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f845ba (AT) newsgroups (DOT) borland.com...
I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and
wished to do the same thing but every attempt to add a new menu to the
existing "Worksheet Menu bar" commandbar is met with the exception "The
parameter is incorrect". I've looked for solution in these newsgroups and
other but no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection
and Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise
would be most grateful (The addin is coded and works, i.e. loads in
Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle
|
|
|
| Back to top |
|
 |
David Hoyle Guest
|
Posted: Sat Sep 02, 2006 1:52 am Post subject: Re: Excel 2000 COM Addins |
|
|
Well,
After a break, a fresh set of eye and new guitar strings I've created the
menu (but the sinks aren't working).
The secret for anyone else who has had this problem is that you must be
explicit about every parameter. Unlike the example I've seen where an
EmptyParam this will not work.
For instead of
Ctrl := Application.CommandBars['Worksheet menu
bar'].Controls_.Add(msoControlPopup, EmptyParam, EmptyParam, EmptyParam,
EmptyParam)
use
Ctrl := Application.CommandBars['Worksheet menu
bar'].Controls_.Add(msoControlPopup, 1 {default for custom control}, 0 {not
sure this matters}, 1 {position to insert}, True {True or False depending
upon whether the menu it temporary or not})
regards
David Hoyle
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f845ba (AT) newsgroups (DOT) borland.com...
| Quote: | I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and
wished to do the same thing but every attempt to add a new menu to the
existing "Worksheet Menu bar" commandbar is met with the exception "The
parameter is incorrect". I've looked for solution in these newsgroups and
other but no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection
and Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise would
be most grateful (The addin is coded and works, i.e. loads in Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle
|
|
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Sat Sep 02, 2006 3:20 pm Post subject: Re: Excel 2000 COM Addins |
|
|
| Quote: | I've downloaded a 30 day trial of your software from CodeCentral. It seem
obvious that you can create a new CommandBar (which I could do anyway) but
does not seem obvious if you can add to an existing CommandBar. Can your
components do this, if not I'm back in the same boat I was in before.
|
There's some good examples at
http://www.afalinasoft.com/office-add-in-express/howto.html#3_10.
Oliver Townshend |
|
| Back to top |
|
 |
David Hoyle Guest
|
Posted: Sun Sep 03, 2006 6:39 pm Post subject: Re: Excel 2000 COM Addins |
|
|
For anyone who's interested the final part of the puzzle was solve, I was
using a local stack variable to reference the Button control when assigning
it a Sink via ConnectInterface(), once changed to a Class variable (i.e.
doesn't go out of scope for the life time of the application) everything
works.
regards
David Hoyle
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f89d98$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Well,
After a break, a fresh set of eye and new guitar strings I've created the
menu (but the sinks aren't working).
The secret for anyone else who has had this problem is that you must be
explicit about every parameter. Unlike the example I've seen where an
EmptyParam this will not work.
For instead of
Ctrl := Application.CommandBars['Worksheet menu
bar'].Controls_.Add(msoControlPopup, EmptyParam, EmptyParam, EmptyParam,
EmptyParam)
use
Ctrl := Application.CommandBars['Worksheet menu
bar'].Controls_.Add(msoControlPopup, 1 {default for custom control}, 0
{not sure this matters}, 1 {position to insert}, True {True or False
depending upon whether the menu it temporary or not})
regards
David Hoyle
"David Hoyle" <david (AT) hoyld (DOT) freeserve.co.uk> wrote in message
news:44f845ba (AT) newsgroups (DOT) borland.com...
I have a lot of existing VBA addin code which I wish to draw a line under
and reimplement as a Delphi COM Addins for Excel. Re-writing the code in
itself isn't a problem but actually getting started is.
I've sent about 4 days going around in circles and failing to be able to
create a new menu in Excel and hook the items up to event handlers.
In VBA I use the CommandBars collection to create the menu system and
wished to do the same thing but every attempt to add a new menu to the
existing "Worksheet Menu bar" commandbar is met with the exception "The
parameter is incorrect". I've looked for solution in these newsgroups and
other but no-one has provided the insight.
I thought I had a brainstorm with the idea of creating the menu using the
ActiveMenuBar collection (which does create a menu but requires VBA event
handlers) and then finding the same items in the CommandBars collection
and Sinking those items but the sinks didn't work - no error messages.
So the question - can you create an additional menu in excel and sink the
control events to Delphi event handlers? Any example code and advise
would be most grateful (The addin is coded and works, i.e. loads in
Excel).
For Reference I'm using the following:
* BDS 2006 Pro (all updated)
* The COM Addins are Delphi Win32 NOT .NET
* Office 2000 Type Libraries
* An Installation of Office XP
* Example code by Brian Long from The Delphi Magazine - Sep 1999
* Several guitars to vent built up frustration.
--
regards
David Hoyle
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|