PC Review


Reply
Thread Tools Rate Thread

Coding UDF's with VSTO

 
 
ma1achai
Guest
Posts: n/a
 
      17th Jun 2008
What is the best way to code UDF's for Excel using VSTO in VS 2008?

Are we still using an automation add-in through COM, or have they developed
a slicker way of exposing functions?

I noticed that if I'm using Excel Services (through SharePoint) that they
have a simple attribute that defines a function as an Excel UDF, as follows:
[UdfMethod(IsVolatile = true, ReturnsPersonalInformation = true)]

Is there something like that if you are not using SharePoint?
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      17th Jun 2008
Everything still has to go via COM, but see
http://www.cpearson.com/Excel/Creati...nctionLib.aspx for examples of
creating a function lib in VB.NET.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)





"ma1achai" <(E-Mail Removed)> wrote in message
news:85496DEA-7F5C-4BE5-A6BE-(E-Mail Removed)...
> What is the best way to code UDF's for Excel using VSTO in VS 2008?
>
> Are we still using an automation add-in through COM, or have they
> developed
> a slicker way of exposing functions?
>
> I noticed that if I'm using Excel Services (through SharePoint) that they
> have a simple attribute that defines a function as an Excel UDF, as
> follows:
> [UdfMethod(IsVolatile = true, ReturnsPersonalInformation = true)]
>
> Is there something like that if you are not using SharePoint?


 
Reply With Quote
 
ma1achai
Guest
Posts: n/a
 
      17th Jun 2008
Thanks for the reply Chip. I was hoping that VSTO had made some sort of
evolutionary step forward and had a better way to do this now...

Also, when using the code:

<ClassInterface(ClassInterfaceType.AutoDual), ComVisible(True)> _
Public Class ExcelDivision

End Class

....doesn't this also expose the System.Object methods to Excel? I haven't
tried it, but I read that in a blog post by Gabhan Berry
(http://blogs.msdn.com/gabhan_berry/a...D00_sharp.aspx).
I was trying his method instead, but am having trouble figuring out how he
gets Excel to see his Functions class as an automation add-in. I tried and I
do not see it show up in the list.

"Chip Pearson" wrote:

> Everything still has to go via COM, but see
> http://www.cpearson.com/Excel/Creati...nctionLib.aspx for examples of
> creating a function lib in VB.NET.
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional
> Excel Product Group
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email on web site)
>
>
>
>
>
> "ma1achai" <(E-Mail Removed)> wrote in message
> news:85496DEA-7F5C-4BE5-A6BE-(E-Mail Removed)...
> > What is the best way to code UDF's for Excel using VSTO in VS 2008?
> >
> > Are we still using an automation add-in through COM, or have they
> > developed
> > a slicker way of exposing functions?
> >
> > I noticed that if I'm using Excel Services (through SharePoint) that they
> > have a simple attribute that defines a function as an Excel UDF, as
> > follows:
> > [UdfMethod(IsVolatile = true, ReturnsPersonalInformation = true)]
> >
> > Is there something like that if you are not using SharePoint?

>

 
Reply With Quote
 
ma1achai
Guest
Posts: n/a
 
      17th Jun 2008
ok... it does look kie the System.Object methods are expoed as well... I can
see the following three in the Functions Wizard under my functions category:

Equal
GetHashCode
GetType
ToString

I can get rid of almost all of them by overriding the method and applying
the [ComVisible (false)] attribute. However, GetType is not override-able.
Any ideas on that one?

I'm still wondering how that addin from the blog works...


"ma1achai" wrote:

> Thanks for the reply Chip. I was hoping that VSTO had made some sort of
> evolutionary step forward and had a better way to do this now...
>
> Also, when using the code:
>
> <ClassInterface(ClassInterfaceType.AutoDual), ComVisible(True)> _
> Public Class ExcelDivision
>
> End Class
>
> ...doesn't this also expose the System.Object methods to Excel? I haven't
> tried it, but I read that in a blog post by Gabhan Berry
> (http://blogs.msdn.com/gabhan_berry/a...D00_sharp.aspx).
> I was trying his method instead, but am having trouble figuring out how he
> gets Excel to see his Functions class as an automation add-in. I tried and I
> do not see it show up in the list.
>
> "Chip Pearson" wrote:
>
> > Everything still has to go via COM, but see
> > http://www.cpearson.com/Excel/Creati...nctionLib.aspx for examples of
> > creating a function lib in VB.NET.
> >
> >
> > --
> > Cordially,
> > Chip Pearson
> > Microsoft Most Valuable Professional
> > Excel Product Group
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> > (email on web site)
> >
> >
> >
> >
> >
> > "ma1achai" <(E-Mail Removed)> wrote in message
> > news:85496DEA-7F5C-4BE5-A6BE-(E-Mail Removed)...
> > > What is the best way to code UDF's for Excel using VSTO in VS 2008?
> > >
> > > Are we still using an automation add-in through COM, or have they
> > > developed
> > > a slicker way of exposing functions?
> > >
> > > I noticed that if I'm using Excel Services (through SharePoint) that they
> > > have a simple attribute that defines a function as an Excel UDF, as
> > > follows:
> > > [UdfMethod(IsVolatile = true, ReturnsPersonalInformation = true)]
> > >
> > > Is there something like that if you are not using SharePoint?

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VSTO Setup problem: Execute VSTO Setup (first install/update) Martin H. Microsoft VB .NET 0 10th Sep 2009 09:27 PM
Vsto gabch Microsoft Excel Programming 1 17th Aug 2006 03:42 AM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan Microsoft Excel Programming 10 6th Oct 2005 01:18 PM
Help! VSTO!! chinimimita.hernandez Microsoft Dot NET Framework 0 13th May 2005 01:24 AM
Problems with coding and coding question!! James Microsoft Access Form Coding 0 23rd Feb 2004 10:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.