Serving the Quantitative Finance Community

 
User avatar
SteveG
Topic Author
Posts: 0
Joined: September 26th, 2002, 2:43 pm

Hiding formulas from Function Paste (fx)

October 4th, 2002, 11:12 am

Does anyone know how I can hide functions, using the Excel SDK and C, from the function paste dialog.Basicly what we want our users to do is only be allowed to write the formulas in, and not be able to select them from the function paste (fx) dialog. Is it possible to hide a Category?Anyhelp would be great.Steve
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Hiding formulas from Function Paste (fx)

October 4th, 2002, 11:49 am

Why ?Dominic
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

Hiding formulas from Function Paste (fx)

October 4th, 2002, 12:23 pm

I think you'll get what you want if you use the keyword "Private", as inPrivate Function Secret (Victim as double) as doubleDominic
 
User avatar
SteveG
Topic Author
Posts: 0
Joined: September 26th, 2002, 2:43 pm

Hiding formulas from Function Paste (fx)

October 4th, 2002, 1:32 pm

Ok we basicly want to send out a worksheet which has formulas in, then we are going to lock and hide the cells and get some visible cells to refer to them. So the user of the worksheet can effectivly not see the formulas. This is because these formulas query the database and can return information like salery, so by hiding the formulas (in worksheet and Paste Function wizard) from the user they will not be aware of this and not find be able to gather sensitive information from the database.We don't want to send out the spreadsheets without any formulas and only values because each month we will need to send the spreadhseet again with that months figures, this was the spreadsheet shows the latest information without giving away our formulas.I hope this makes sense why we want to hide the formulas / functions.I don't think using the private keyword will work, as we are using C and if we make the function/formula private in the C SDK code then the formula will not be visible at all to Excel.CheersSteve
 
User avatar
PinballWizard
Posts: 4
Joined: March 13th, 2002, 4:36 pm

Hiding formulas from Function Paste (fx)

October 4th, 2002, 1:52 pm

A custom function must be declared as Public in a standard code module. If declared Private it will not be accessible from the worksheets and thus unavailable to the users.
 
User avatar
jamesbattle
Posts: 0
Joined: May 12th, 2002, 8:28 pm

Hiding formulas from Function Paste (fx)

October 4th, 2002, 2:23 pm

I'd be very worried about using this approach as it means that any tinyproblem (bug) will result in sensitive information being shown...
 
User avatar
SteveG
Topic Author
Posts: 0
Joined: September 26th, 2002, 2:43 pm

Hiding formulas from Function Paste (fx)

October 4th, 2002, 2:55 pm

Well as long as the cells with the formula in are hidden and protected we should be ok.Don't forget people that I am using C and the Excel SDK to write these formulas/function, and not VBA.
 
User avatar
DavidJN
Posts: 266
Joined: July 14th, 2002, 3:00 am

Hiding formulas from Function Paste (fx)

October 6th, 2002, 2:56 pm

I might be a bit fuzzy about this because I learned the Excel C API quite some time ago. But I distinctly remember using C DLL functions in spreadsheets without using the function wizard. The C function must be an ordinary exportable DLL function (by this I mean the magic words “__declspec (dllexport)” or equivalent, are in the function header and the DLL must be physically some place where Windows can find it (i.e. in the “path”).What I remember doing is manually typing the function name into the formula bar (not the function wizard), supplying the necessary arguments and it worked. Are any of your arguments array arguments? Array arguments are always pretty ugly between Excel and C/C++.By the way, in Excel help, try typing “Call” or "Register" and you will see somewhat cryptic discussions on this topic.
 
User avatar
SteveG
Topic Author
Posts: 0
Joined: September 26th, 2002, 2:43 pm

Hiding formulas from Function Paste (fx)

October 9th, 2002, 8:15 am

Yeah I seem to have already done what you suggested, and I can type the names of formulas into the formula bar, but they still appear in the function wizard (fx - button), think if it can be done, then it will have something to do with the register call but not sure what.Cheers for all the help so far.Steve.
 
User avatar
maximt
Posts: 0
Joined: July 14th, 2002, 3:00 am

Hiding formulas from Function Paste (fx)

October 9th, 2002, 9:52 am

QuoteWell as long as the cells with the formula in are hidden and protected we should be ok.It depends on your objective, of course, but bear in mind that Excel built-in password protection is not that strong. You can even brute-force pproach works in reasonable time http://www.elcomsoft.com/prs.html#ae2000pr">MS Office Password RecoveryI support jamesbattle's concern that you're heading for trouble with current approach. Have you considered securing the database instead? Like create another data source that does not include the sensitive data and have your spreadsheet connect there.
 
User avatar
Russell
Posts: 1
Joined: October 16th, 2001, 5:18 pm

Hiding formulas from Function Paste (fx)

October 9th, 2002, 1:36 pm

Why don't you add another argument to the function. This argument could be algorithmically related to the other input arguments in a way that only you as the developer understand i.e. a checksum of some sort. In the code you can check to see if the checksum works ok, and if so allow the function to run else don't return anything. Calling it something cryptic usually helps too!If the private information is in a particular table in the database why don't you just block access to that inside the code of the function i.e. allow it to query the table [Sales] but not the table [Salaries]?
 
User avatar
EngMoi
Posts: 0
Joined: September 30th, 2002, 10:01 am

Hiding formulas from Function Paste (fx)

October 9th, 2002, 6:18 pm

Removing a function from the function wizard is a pain due to a fxxxxxx Microsoft bug. There is a workaround that does what you want. Check thathttp://longre.free.fr/pages/prog/api-c.htm#Assistantso just register your functions then immediately transform them into hidden functionsBest, Eng.
 
User avatar
SteveG
Topic Author
Posts: 0
Joined: September 26th, 2002, 2:43 pm

Hiding formulas from Function Paste (fx)

October 14th, 2002, 9:43 am

Cheers for this, I had found this article before but never bothered to translate it.I sorted the problem out by changing one of the params for the xlfRegister to be 0 instead of 1err = Excel(xlfRegister, 0, 1+ARGCOUNT, (LPXLOPER)&xDll, (LPXLOPER)TempStr(func[0]), (LPXLOPER)TempStr(func[1]), (LPXLOPER)TempStr(func[2]), (LPXLOPER)TempStr(func[3]), (LPXLOPER)TempStr(sHiddenFunc), //This set 0 hides the functions from the wizard, set to 1 makes it visible again.Cheers for the help pointing me in the right direction, got another question now, but will post on a separate thread, all about trying to hide the formula name from the formula bar.Steve.