Hi I am a C/C++ programmer,not a VBA or OLE expert. I have an xll which registers a function with a type_text of ACCCF. The F data type is supposed to allow inplace modification of strings upto 255 bytes.In the xll the function has

extern "C" DLLEXPORT BOOL FAR PASCAL EXPORT MyXLLFunc(char FAR *pszDAOObject, char FAR *pszCommand,
char FAR *pszKeyword, char FAR *pszParameter, char *pszReturn)
{
int iLen;
char pszBuffer[255];
/*some function to get some text and put it into pszBuffer and the length into iLen, then ...*/
_tcsncpy(pszReturn, pszBuffer, iLen);
return 1;
}

In my VBA macro I have something like

Sub RunMyFunc()
Dim MyValue(255) As String
Sheets("Sheet1").Select
Range("A15").Select
ActiveCell.Value = Application.Run("MyXllFunc", "View_1", "MyCommand", "MyKeyword", "MyParameter", MyValue)
MsgBox CStr(MyValue)
End Sub

when I run my macro, whatever I do I get MyValue in the VBA function empty after the XLL call. I have tried using MyValue as a fixed length string (Dim MyValue as String *255) and as an array of Bytes (Dim MyValue(255) As Byte) but nothing works. In the debugger, the MyXllFunc is called correctly and updates the pszReturn buffer correclty, but this never gets back into the VBA code correctly. The return value from the MyXLLFunc does get into A15 correctly.

What am I doing wrong? Thanks for any help.