V
Vince
Hi all,
I've written a program in VBA which is supposed to Shell another Perl
program. The latter writes a file which the VBA program needs to capture and
load on to Word:
VBA {User selects some text} - {VBA writes this text to a file} - {VBA
Shells the Perl program with the path to this File} - {The Perl program
writes another file} - {VBA reads that file and replaces the selected text
with the contents of that file}
Now, here are the problems:
(1) Main problem: I don't know when the Perl program will finish running
(Sometimes it takes seconds or worst case, a minute) If I read the output
file before Perl finishes running, I display an old file to the user (who
won't be very impresed)
(2) The Input file that I write using this code:
ST = Selection.Text
FF=freefile
Open ToolName.TextBoxName.Text For Output As #FF
ST = Replace(ST, vbCrLf, Chr(13)) ' Somehow, all New lines are not there
if I don't do this
Print #FF, ST
Close (FF)
does not work sometimes! The Perl program can only read the first line!
However, when I open it using Notepad, it looks alright to me. Now, here's
the other weird part. When I Copy & Paste the Selection and save it in
Notepad and suppy this input file path to Perl, it runs fine.
I suppose problem #1 is more of a pain than problem #2.
Any ideas?
Thanks,
Vince
I've written a program in VBA which is supposed to Shell another Perl
program. The latter writes a file which the VBA program needs to capture and
load on to Word:
VBA {User selects some text} - {VBA writes this text to a file} - {VBA
Shells the Perl program with the path to this File} - {The Perl program
writes another file} - {VBA reads that file and replaces the selected text
with the contents of that file}
Now, here are the problems:
(1) Main problem: I don't know when the Perl program will finish running
(Sometimes it takes seconds or worst case, a minute) If I read the output
file before Perl finishes running, I display an old file to the user (who
won't be very impresed)
(2) The Input file that I write using this code:
ST = Selection.Text
FF=freefile
Open ToolName.TextBoxName.Text For Output As #FF
ST = Replace(ST, vbCrLf, Chr(13)) ' Somehow, all New lines are not there
if I don't do this
Print #FF, ST
Close (FF)
does not work sometimes! The Perl program can only read the first line!
However, when I open it using Notepad, it looks alright to me. Now, here's
the other weird part. When I Copy & Paste the Selection and save it in
Notepad and suppy this input file path to Perl, it runs fine.
I suppose problem #1 is more of a pain than problem #2.
Any ideas?
Thanks,
Vince