I assume you wrote the VC program that excepts two aruguents arg(1) and
arg(2) with arg(0) being the file name. You would use a shell method in
VBA. the sheell method will not search the PATH envirnoment variable (
I can modify the code to search the path easily) so yo must include the
path name of your VC EXE
Shell("c:\temp\MyVC arg1 arg2")
to get the parameters into the command do this
arg1 = range("A1")
arg2 = range("B1")
Shell("c:\temp\MyVC " & arg1 & " " & arg2)
Notice I put two spaces in the line above (one after MYVC)
Now you just need to use a Close Workbook macro to run the code.
Private Sub Workbook_BeforeClose(Cancel as Boolean)
with Sheets("Sheet1")
arg1 = .range("A1")
arg2 = .range("B1")
end with
Shell("c:\temp\MyVC " & arg1 & " " & arg2)
End Sub
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=165210
Microsoft Office Help