December 9th, 2002, 11:55 am
Does anyone know how to make Excel 97/2K behave correctly when you have a formula with no parameters.What I have is a function which returns the current NT user, so I don't want to pass any parameters into the function, but when you click on the fx button, to get the Paste Function Wizard, and select the "NT User" formula it displays a dialog asking for one parameter, and if any value is entered into this field it fails to return the NT user name.Also does any one know what is happening when you use the formula in an Excel Cell as =NTUSER without the (Parenthesis), as I get a value of 330498049?The function is written aschar* WINAPI NTUSER(void){ DWORD iMaxLen = UNLEN+1; //UNLEN - largest possible NT User name. static char UserName[UNLEN+1]; if (GetUserName(&UserName[0],&iMaxLen)) return UserName; else return "";}and is regestered with Excel like this:-err = Excel(xlfRegister, 0, 20, (LPXLOPER)&xDll, (LPXLOPER)" NTUSER", (LPXLOPER)" C!", (LPXLOPER)" NTUSER", (LPXLOPER)" ", (LPXLOPER)" 1", (LPXLOPER)" NT User", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" Returns the Current Logged on User.", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", (LPXLOPER)" ", ); Cheers for all the help people provide on this forum.Steve.