WFTPConsole and VBA not working together

Please post here if you have problems in using Wing FTP Server.
Post Reply
jimdaway
Posts: 2
Joined: Wed Mar 05, 2014 9:59 pm

WFTPConsole and VBA not working together

Post by jimdaway »

Hello;

I'm on a Win7 Pro machine and have VBA code under Outlook 2003 to allow certain people in the company to e-mail a particular e-mail address to create new users, etc. When Outlook receives an e-mail with a specific word in the subject line, the VBA code writes data to a text file then fires a shell command to invoke the WFTPConsole.exe with a lua script that creates a new directory on our server, creates a new user, maps the directory and sends an e-mail confirming all is well to the requester.

If I use a cmd window and invoke the WFTPConsole with the lua script, it works perfectly.

If I run the vba code, it appears to work perfectly as it returns the handle of the WFTPConsole instance I just called however, the WFTPConsole doesn't run the lua script.

Both sides seem to be working when initiated on their own but they will not play nice together! I've tested the vba shell call to invoke notepad, calc and a couple other programs and it works perfectly. When I open a cmd window and invoke WFTPConsole with the lua script, it works perfectly. When I put them together, nada.

I'm really at a loss to explain this. Any help would be appreciated.
jimdaway
Posts: 2
Joined: Wed Mar 05, 2014 9:59 pm

Re: WFTPConsole and VBA not working together

Post by jimdaway »

SOLVED!!

As I indicated above, everything worked perfectly if the two pieces (vba & console/lua) were initiated separately. The VBA seemed to work without issue because the shell cmd window would flash and it WAS returning a valid handle number. Likewise, the console program to execute the lua script was working perfectly if executed from a cmd window in its native directory.

I composed a batch file in the WFTP install directory to: echo a start msg, run the WFTPConsole.exe, echo a stop msg and then pause so I could capture what was happening then I changed my vba code to shell call the batch file.

The issue that came to light using my batch file was that the vba code was leaving me in a MAPI directory somewhere down the Windows tree. I'm assuming that the ftp console program was picking up this working directory and not firing my lua code nor returning any "failure to launch" indications.

I've now created a batch file that simply changes my directory to WingFTPConsole's installation directory then executes the console exe with the lua code.

BTW, this all worked perfectly on a different PC with the same operating system, same UAC and macro security setting, same, same, same - as far as I could tell.

It's been a long night. Time for some rest...
Post Reply