LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Passing an array of strings from VBA to C

Hi, I had asked this before but in a VB group they suggested I come
ask it he
I can pass single strings between VBA and C (dll) without problem.
But now I am trying to pass an array of strings from VBA to a C file
(as a test) but that is not working at all maybe someone can give
hints. I'm using VBA for excel 2003 on winXP. Thanks.

The C file that is made into 'mydll.dll"
#include "windows.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
__declspec (dllexport) void __stdcall CFUN(LPSTR **pout)
{
FILE *in=fopen("c:/excel.txt","w");
int i;
for (i=0;i<4;i++)
{
fprintf(in, "%s\n", *(pout+i));
}
fclose(in);

}

The VBA code:
Private Declare Function CFUN& Lib "c:/mydll.dll" (ByRef pout As
String)
Sub TEST()
Dim pout(4) As String
pout(0) = "one"
pout(1) = "two"
pout(2) = "three"
pout(3) = "four"
CFUN (pout(0))
End Sub

The excel.txt file does not contains the strings
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing array of strings to excel Nikolay Belyh Excel Programming 4 May 18th 07 03:31 PM
Passing array of strings from DLL function to VBA Jag Man Excel Programming 0 January 12th 04 10:09 PM
passing strings vba man Excel Programming 0 December 21st 03 07:12 PM
passing strings pabs[_7_] Excel Programming 2 December 19th 03 06:25 PM
passing strings Sirron Excel Programming 2 August 27th 03 04:33 PM


All times are GMT +1. The time now is 09:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"