Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Tom Ogilvy" wrote in message ... If it is a xll/dll, I believe you would declare it just like a windows API. (rather than set a reference to it). This article gives an example of making a DLL and calling it from VB (should be the same for VBA). http://support.microsoft.com/default...46&Product=vbb Include the path if it isn't in the system directory I believe. HOWTO: Pass Optional Parameters to a C DLL Function from VB -- Thanks Tom. Couldn't quite get it to work. So I'll post more info and perhaps you or someone else could suggest the precise declaration to use. 1. Function Registering Table: static LPSTR func[][14] = { { " getURL" , " RP" , " getURL" , " URL String" , " 1", " Transcend", " ", " ", " Non Volatile NOW()" , " This dummy dependency argument is unused inside the funtion", " ", " ", " ", " "}, }; 2. The DEF file snippet: getURL 3. And here's the very ugly getURL function (but it works) LPXLOPER __stdcall getURL(LPXLOPER inX) { static XLOPER xRes; Excel4(xlfNow, &xRes, 0); // Returns an xltypeNum; xRes.xltype = xltypeStr; xRes.val.str = (PUCHAR) " Input not a URL"; if (inX-xltype == xltypeStr) { string *a = new string(" " + utilityURLToString(toStr(inX-val.str))); // a function that uses the curl package compiled into the addin. xRes.val.str = (PUCHAR) a-c_str(); xRes.val.str[0] = a-length() - 1; xRes.xltype = xltypeStr; } return &xRes; } This works beautifully in worksheets and I want to have the function getURL available in VBA! Very many thanks!!! I would be exstatic if I can get this to work and I think this will be useful to others as well! (Hopeful) Bura |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking to another file using file reference typed cell | Excel Worksheet Functions | |||
cross-reference data from one file to another file | Excel Discussion (Misc queries) | |||
How do I reference external data from a file, file name found in . | Excel Discussion (Misc queries) | |||
copy/paste from one file to another without file name reference | Excel Discussion (Misc queries) | |||
reference to .dll file | Excel Programming |