ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Add-ins (https://www.excelbanter.com/excel-programming/273463-excel-add-ins.html)

WAYNE MAIURI

Excel Add-ins
 
Does anybody out there know how to create an xll file? I have some
code that I am running in the Worksheet_SelectionChange(ByVal Target As
Range) event handler, but I would like to make it an add-in so I can use
it on all my files when I open them.

Any help would be greatly appreciated
Thanks in Advance!
Wayne




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Aaron Queenan

Excel Add-ins
 
If you want to handle COM events, you're probably better of writing a COM
add-in rather than a Excel 4 (XLL) add-in.

Using the Visual Studio .NET wizard, select File/New Project, Other
Projects, Extensibility Projects, Shared Add-in, and follow the wizard steps
to create the project.

The other way of making one is to create a simple COM object:

1. Add the following to stdafx.h. For VC++ 6.0, change
"progid:Excel.Workspace" to "C:\Path\Excel.exe".

// Microsoft Add-In Designer Object Library
#import "progid:MSAddnDr.AddInDesigner" auto_rename, auto_search

// Microsoft Excel 10.0 Object Library
#pragma warning(push)
#pragma warning(disable : 4192) // automatically excluding 'name'
while importing type library 'library'
#pragma warning(disable : 4298) // identifier in type library
'library' is already a macro; renaming to '__identifier'
#pragma warning(disable : 4337) // cross-referenced type library
'typelib1' in 'typelib2' is being automatically imported
#import "progid:Excel.Workspace" auto_rename, auto_search,
no_implementation
using Excel::IRtdServer;
#pragma warning(pop)

2. Add the following to the .rgs file. Replace 'Plugin.Progid' with your
simple objected progid.

HKLM
{
NoRemove Software
{
NoRemove Microsoft
{
NoRemove Office
{
NoRemove Excel
{
NoRemove AddIns
{
'Plugin.Progid'
{
val
Description = s 'My plug-in short name'
val
FriendlyName = s 'Description of my plug-in'
val
LoadBehavior = d 3
}
}
}
}
}
}
}

3. Add the following to your class inheritance. NOTE the __uuidof
(Excel::AppEvents) is NOT a typo, even though the Excel::IAppEvents is being
implemented. Visual C++ .NET 2003 (and possibly other versions) doesn't
understand the wierd stuff Office puts in its type library, such as
implementing the dispinterface for the events directly rather than
inheriting from the vtable interface.

public IDispatchImpl<Excel::IAppEvents,
&__uuidof(Excel::AppEvents), &__uuidof(Excel::__Excel),
/* wMajor = */ 1, /* wMinor = */ 4,
public IDispatchImpl<AddInDesignerObjects::_IDTExtensibil ity2,
&__uuidof(AddInDesignerObjects::_IDTExtensibility2 ),
&__uuidof(AddInDesignerObjects::__AddInDesignerObj ects),
/* wMajor = */ 1, /* wMinor = */ 0

Note that COM add-ins require Excel 2000 or later.

Regards,
Aaron Queenan.

"WAYNE MAIURI" wrote in message
...
Does anybody out there know how to create an xll file? I have some
code that I am running in the Worksheet_SelectionChange(ByVal Target As
Range) event handler, but I would like to make it an add-in so I can use
it on all my files when I open them.

Any help would be greatly appreciated
Thanks in Advance!
Wayne




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




EZ Money

Excel Add-ins
 
Addins have the extension .xla. You can simply Save As that type, then
ToolsAddinsBrowse to locate the file. If it is checked in ToolsAddins, it
should be available to you.

--
Greeting from the Gulf Coast!
http://myweb.cableone.net/twodays
"WAYNE MAIURI" wrote in message
...
Does anybody out there know how to create an xll file? I have some
code that I am running in the Worksheet_SelectionChange(ByVal Target As
Range) event handler, but I would like to make it an add-in so I can use
it on all my files when I open them.

Any help would be greatly appreciated
Thanks in Advance!
Wayne




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Keith Willshaw

Excel Add-ins
 

"WAYNE MAIURI" wrote in message
...
Does anybody out there know how to create an xll file? I have some
code that I am running in the Worksheet_SelectionChange(ByVal Target As
Range) event handler, but I would like to make it an add-in so I can use
it on all my files when I open them.

Any help would be greatly appreciated
Thanks in Advance!
Wayne


Unless you are an expeirenced C++ programmer (and even if you are)
I wouldnt recommend using XLL add-ins for this.

It will be much simpler to migrate your code to a com add-in
with VB

Keith




All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com