Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Implement Excel cell function using VSTO

Hi

Is there any way to implement a user defined function for use in spreadsheet
cells using VSTO? Is it possible/neccesary to use a vba add-in to make a call
back into a managed VSTO app?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Implement Excel cell function using VSTO

You can just create a Class Library in VS2005, reference it from the
Automation Add-Ins dialog (access this from the XLA Add-Ins dialog), and
then use the function directly from a cell. Neither VBA nor VSTO is
necessary. See "Creating A Function Library In VB.NET" at
http://www.cpearson.com/Excel/Creati...nctionLib.aspx .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Andrew Wiles" wrote in message
...
Hi

Is there any way to implement a user defined function for use in
spreadsheet
cells using VSTO? Is it possible/neccesary to use a vba add-in to make a
call
back into a managed VSTO app?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Implement Excel cell function using VSTO

Chip

It's not so much a case of "don't need VSTO". We have a fairly substantial
app that is already built in VSTO and I would therefore prefer not to
introduce another layer unless there is no other way.

I gues that our app could consist of a combination of VAST and xla but I
need to make sure that any function calls from the vba add-in access the
correct application state within the VSTO app.



"Chip Pearson" wrote:

You can just create a Class Library in VS2005, reference it from the
Automation Add-Ins dialog (access this from the XLA Add-Ins dialog), and
then use the function directly from a cell. Neither VBA nor VSTO is
necessary. See "Creating A Function Library In VB.NET" at
http://www.cpearson.com/Excel/Creati...nctionLib.aspx .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Andrew Wiles" wrote in message
...
Hi

Is there any way to implement a user defined function for use in
spreadsheet
cells using VSTO? Is it possible/neccesary to use a vba add-in to make a
call
back into a managed VSTO app?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Implement Excel cell function using VSTO

The official response from Microsoft technical support on this question is
that you cannot implement a UDF in a VSTO application. It is neccesary to
create a second add-in which uses a hidden worksheet or remoting for
communication.

"Andrew Wiles" wrote:

Chip

It's not so much a case of "don't need VSTO". We have a fairly substantial
app that is already built in VSTO and I would therefore prefer not to
introduce another layer unless there is no other way.

I gues that our app could consist of a combination of VAST and xla but I
need to make sure that any function calls from the vba add-in access the
correct application state within the VSTO app.



"Chip Pearson" wrote:

You can just create a Class Library in VS2005, reference it from the
Automation Add-Ins dialog (access this from the XLA Add-Ins dialog), and
then use the function directly from a cell. Neither VBA nor VSTO is
necessary. See "Creating A Function Library In VB.NET" at
http://www.cpearson.com/Excel/Creati...nctionLib.aspx .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Andrew Wiles" wrote in message
...
Hi

Is there any way to implement a user defined function for use in
spreadsheet
cells using VSTO? Is it possible/neccesary to use a vba add-in to make a
call
back into a managed VSTO app?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Implement Excel cell function using VSTO

On 1 Nov, 12:06, Andrew Wiles
wrote:
The official response from Microsoft technical support on this question is
that you cannot implement a UDF in a VSTO application. It is neccesary to
create a second add-in which uses a hidden worksheet or remoting for
communication.



"Andrew Wiles" wrote:
Chip


It's not so much a case of "don't need VSTO". We have a fairly substantial
app that is already built in VSTO and I would therefore prefer not to
introduce another layer unless there is no other way.


I gues that our app could consist of a combination of VAST and xla but I
need to make sure that any function calls from the vba add-in access the
correct application state within the VSTO app.


"Chip Pearson" wrote:


You can just create a Class Library in VS2005, reference it from the
Automation Add-Ins dialog (access this from the XLA Add-Ins dialog), and
then use the function directly from a cell. Neither VBA nor VSTO is
necessary. See "Creating A Function Library In VB.NET" at
http://www.cpearson.com/Excel/Creati...nctionLib.aspx.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Andrew Wiles" wrote in message
...
Hi


Is there any way to implement a user defined function for use in
spreadsheet
cells using VSTO? Is it possible/neccesary to use a vba add-in to make a
call
back into a managed VSTO app?- Hide quoted text -


- Show quoted text -


It looks to me like a shimmed Automation add-in is what you want.
That will do UDFs, and can be automatically loaded by C# code in your
VSTO add-in along these lines:

private static void SetUpAutomationAddIn(Excel.Application
excelApp, string automationAddInProgId)
{
// Can't enumerate this Office collection with foreach.
See
// http://support.microsoft.com/default...b;en-us;328347

for (int i = 1; i <= excelApp.AddIns.Count; i++)
{
if (excelApp.AddIns[i].progID ==
automationAddInProgId)
{
if (excelApp.AddIns[i].Installed == false)
{
excelApp.AddIns[i].Installed = true;
}

// The Automation add-in is set up.
return;
}
}

// Add a workbook if there isn't already one there. Need
to do this
// to ensure that the AddIn manager is available before we
call AddIns.Add.
// See Microsoft Knowledge Base Article - 280290
if (excelApp.Workbooks.Count == 0)
{
excelApp.Workbooks.Add(Missing.Value);
}

AddIn addedAddIn =
excelApp.AddIns.Add(automationAddInProgId, true);
addedAddIn.Installed = true;
}
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use a function to implement a naming convention? bestrada Excel Worksheet Functions 2 January 20th 09 08:06 PM
How do I implement if-else functionalilty for a cell in excel? Raja Suman Excel Programming 3 September 14th 06 06:25 AM
Do anyone know how to implement the function? minrufeng[_3_] Excel Programming 2 August 12th 05 07:38 PM
Better Way To Implement Indirect IF Function? BJ Excel Discussion (Misc queries) 8 June 9th 05 02:59 AM
Implement CSE function through VBA with parameters Bastanu Excel Worksheet Functions 2 March 18th 05 02:11 AM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"