Re: Call tool from VBA
- From: C B <cb0@xxxxxxx>
- Date: Fri, 15 Jun 2007 19:20:28 +0700
In article <towb-F2726D.20560614062007@xxxxxxxxxxxxx>,
Tobias Weber <towb@xxxxxxx> wrote:
In article <1181844995.940105.3310@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"gimme_this_gimme_that@xxxxxxxxx" <gimme_this_gimme_that@xxxxxxxxx>
wrote:
Get Office 2004.
Finally something useful from you. Unfortunately I cannot afford both
2004 now and 2008 in a few months.
So maybe we can get back to the original question: how to use the
"Shell" VBA function on the Mac to call a unix program?
I came up with this monstrous hack:
In VBA (note the 2nd WorkPathUnix on the cmd line is a parm to the perl
script):
' For info on DoShellScript See
' http://developer.apple.com/technotes/tn2002/tn2065.html
' Note that the stderr redirection makes sure
' err messages from Perl get back to r
cmd = "set mySlug to do shell script ""/usr/bin/perl " & WorkpathUnix &
"plmain.pl " & WorkpathUnix & " 2>&1"""
rtn = MacScript(cmd)
If rtn <> "OK" Then
MsgBox ("Aborting: problem with perl script")
Exit Sub
End If
The script included this:
# DoShellScript goes nuts with a nonzero rc, which in turn
# screws up MacScript. Nice.
#
END {
exit 0;
}
#(other stuff)
die "workdir parm $workdir is not a directory" unless -d $workdir;
#(and at exit, of course:)
print "OK";
exit 0;
----
I hope that helped. Thanks to gimme_this_gimme_that for the
MacPerl::AppleScript --- wish I had known about that earlier.
PS You two should chill out -- you both sound pretty smart
(and freakin' uncivil)
.
- References:
- Re: Call tool from VBA
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Call tool from VBA
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Call tool from VBA
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Call tool from VBA
- From: gimme_this_gimme_that@xxxxxxxxx
- Re: Call tool from VBA
- Prev by Date: Excel Default
- Next by Date: Re: Excel Default
- Previous by thread: Re: Call tool from VBA
- Next by thread: Re: Call tool from VBA
- Index(es):
Relevant Pages
|