 |
|
|
 |
|
 |
Straight forward. Gets one started with minimal fuss.
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Dear All,
I got some trouble running the above UDF. I'm working on Windows XP / Visual Studio 2008 / Office 2007. The generated DLL register itself, but once i added it to excel addins, it only appears in the list of "Inactive Application Add-ins".
Have you any idea on how i could debug such a situation ?
Best regards,
Jean-Pierre
|
|
|
|
 |
|
 |
Maybe you have your answer already... ? Obviously Excel has trouble to find the path to mscoree.dll, so it helps to register the full path to it. You can add the following lines to the RegisterFunction: Dim key As RegistryKey = Registry.ClassesRoot.OpenSubKey("CLSID\\{" + t.GUID.ToString().ToUpper() +
"}\\InprocServer32"), True)
key.SetValue("", (Environment.SystemDirectory & "\mscoree.dll"), RegistryValueKind.String)
Hope it still helps you.
|
|
|
|
 |
|
 |
Hello Michael,
After spending lots of time trying to understand why my addon was inactive, i finally found the solution. There was an exception in the load event function.
Thank you for your answer
Best regards,
Jean-Pierre
|
|
|
|
 |
|
 |
Hi,
I have a library of C# functions which I have used successfully in Excel/VBA..so far! Lately, I have encountered a strange problem - I copied a pasted the solution folder on another machine and built the solution. It built fine and I could add the reference in VBA. However, when I debug it i am unable to enter the C# code (I have been able to do this successfully in the past!). The problem gets resolved when I create a new solution and copy and paste all my files in the new project (I therefore suspect it is something to do with the project settings..). It is very cumbersome for me to do this exercise often (between my home and office machines!). Can someone please advise a fix? (I have tried the update KB907417 as well..didn't work this time ).
Thanks in advance.
Asim
|
|
|
|
 |
|
 |
Thanks a lot, your article is clear even if I have to admit I never got it to work.
But I found your ExcelDna project (http://groups.google.com/group/exceldna) in your comments, this is simply great !
Works very fine, very easy to use (only the emit at first is a little slow but hey), looks very powerful and code is very cleanly written.
Bravo, and thanks a lot for sharing that!
Alan.
|
|
|
|
 |
|
 |
hey ppl, how can i make a value in a cell or in a range of cells read only!?
|
|
|
|
 |
|
 |
hey ppl, how to place a button on the active/ any excel cell programatically while building an excel automation add in?? I need the code dat would display a button on an excel cell.
|
|
|
|
 |
|
 |
hii
i am using C#.NET 2005 my problem is that there is already an function developed some thing like " Add2(3,4)"
and now i have to call this from another C# program the code which i have used is given below ,my problem is that
the excell which is saved does not recognise the formula "Add2(3,4)" i am using excel 2007.
Excel.Workbooks objBooks;
Excel.Application objApp = (Excel.Application)new Microsoft.Office.Interop.Excel.ApplicationClass();
objBooks = objApp.Workbooks;
Excel.Workbook objBook = objBooks.Add(System.Reflection.Missing.Value);
Excel.Worksheet objSheet = (Excel.Worksheet)objBook.Worksheets.get_Item(1);
objSheet.Activate();
Excel.Range range = ( Excel.Range)objSheet.Cells[1, 1];
range.Formula = "=Add2(3,4)";
string FName = "";
if (SaveF.ShowDialog() == DialogResult.OK)
{
FName = SaveF.FileName;
object objMissing = System.Reflection.Missing.Value;
objBook.SaveAs((object)(FName), objMissing, objMissing, objMissing, objMissing, objMissing, Excel.XlSaveAsAccessMode.xlNoChange, objMissing, objMissing, objMissing, objMissing, objMissing);
objBook.Close(false, objMissing, objMissing);
objApp.Quit();
thanks...
|
|
|
|
 |
|
 |
I think the add-ins are not automatically loaded in the Excel application you create via Automation. You might need to add your add-in that contains the UDF explicitly, using Excel.AddIns..... (not sure how the object model looks.)
Also have a look at my newer project, ExcelDna (http://groups.google.com/group/exceldna) for making Excel Add-Ins and User-Defined Functions with .Net.
|
|
|
|
 |
|
 |
its due to regional ssetting problem.i am sure.....
|
|
|
|
 |
|
 |
hi
i am trying to make a Excel 2007 UDF using vb .net 2003 to build an automation add in.
When i build the dll and add it to excel add in list through automation button, the dll gets added. the functions are available in the excel functions list.
However on using the function name in the cell, i get a #REF! error.
interestingly, if i use the fully qualified name fo the function, for example AutomationAddin.MyFunctions.MultiplyNTimes, the function executes and gives correct value. The function changes to 'MultiplyNTimes' immediately and gives error on editing again.
Can you please advise how to solve this.
Thanks
|
|
|
|
 |
|
 |
I performed all the steps and build the solution.
The excel.exe.config file was also added in office11 folder.
The dll is getting registered.
The automation add in gets displayed in automation server
but then when the function is called in the excel cell it fails - #NAME?
Please guide me ..Urgent.
The same works well in excel 2003.
|
|
|
|
 |
|
 |
Hi you all out there.
I am trying to create the addin as described in the article, and also copied the .dll to the same location as the excel, and tried to register it by running the regasm on it.
But I always get an error message saying
RegAsm error: Failed to load 'NAddIn.dll' because it is not a valid .Net assembly
I am using Windows Vista and Microsoft Visual C# 2008 Express Edition. Does anyone have a solution to the problem?
Thanks
Klaus G
|
|
|
|
 |
|
 |
Be sure that you are using the regAsm tool for the .Net version that you built the assembly with.
For example if you are using VS2005, which compiles using the .NET 2.0 Frame work you would use this command:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm /codebase NAddIn.dll
The NAddIn.dll file being located in the C:\WINDOWS\System32 directory
I hope that this helps I am pretty new to C# and the .Net framework
|
|
|
|
 |
|
 |
I have written a dll in c# .NET 2.0 and have added the dll as an automation add-in for excel 2003 on my local machine. And it works great, thank you for the aid.
My problem is I want to use the dll as an add-in to excel 2003 on another machine. I have used regasm to register the dll on another machine and I have even been able to add the the dll as an automation add-in. Where it falls flat is that I cannot call any functions within excel on the other machine where I can call these functions on my local machine.
If anyone can help please let me know where I am going wrong.
Will
|
|
|
|
 |
|
 |
It is now working. The solution is as follows.
Add the dll to the same location as Excel.exe.
Run regasm.exe /codebase .dll
This registers it correctly and the functions can now be used within excel.
Will
|
|
|
|
 |
|
 |
Hi,
I got the function to work, but not when I try to make a function that takes a range. I've tried (among other things):
public double test(object input) { Excel.Range r = (Excel.Range)input; ...
public double test(object[] input) { Excel.Range r = (Excel.Range)input; ...
public double test(object[,] input) { Excel.Range r = (Excel.Range)input; ...
public double test(object input) { double[] r = (double[])input; ...
etc, etc, etc...
When I debug the input, I see that I get an exception...that I was missing the PIA - Microsoft.Excel.Interop...
Do I need this? Is there anyway to get this to work without it?
|
|
|
|
 |
|
 |
So I used this great method to create my Automation Add-In and it all works fine. Then with one function that uses an Enum as a paramater I got an interesting result:
1) If I input the number corresponding to the Enum parameter I want to use into the function parameter it works great
2) If I type the name/string of the Enum parameter I want to use again it works but it always assumes the Enum parameter is 0
3) If I reference a cell with either the name or number of the Enum parameter I get a #VALUE! error
So, does anybody know why this happens? And even better does anybody know how you can write the name of the Enum parameter or a reference to a cell with it directly into the function parameter and have the UDF work?
Thanks very much for your help
|
|
|
|
 |
|
 |
It's working fine on my machine with Office 2003 (SP2). I developed it using VS2005. I wanted to give the AddIn to another user for testing. On his machine, .net 2.0 framework and Office 2003 (SP2) are installed (visual studio is not installed on his machine).
I copied the .dll file and ran Regasm.
When I open Excel, I can see the Addin in the List of addins (Tools--> Addins), But when i try to enter the function in a cell it's not recognised and on checking in the "Insert Function Dialog box" , my addin is not appearing in the list.
I even tried the steps mentioned in this article (kb908002). But still it's not working.
Any help to solve this issue is greatly appreciated.
|
|
|
|
 |
|
 |
Found an answer to my own question. You just need to install this Office update:
http://www.microsoft.com/downloads/details.aspx?FamilyId=1B0BFB35-C252-43CC-8A2A-6A64D6AC4670&displaylang=en
This will only work if the AddIn was developed with VS2005 and you're using Excel 2003 which is my case.
|
|
|
|
 |
|
 |
Thanks very much for posting this. I have been looking for some time with no joy for a way to use C# Express to build Excel Add-Ins and you have solved my problem.
What we are now missing is how to add the explanatory text to each function paramater that would come up if using the function wizard.
Is it possible to post how to do that please?
Many Thanks
-- modified at 8:27 Friday 26th October, 2007
Having now read through the comments on this site I see that you have to write an XLL not a DLL to do this.
|
|
|
|
 |