what's the exact output when you run it from the command line?
When you run from the cmdline, does an excel window visibly open? From cgi, you probably want the window to be hidden (i forget offhand the code tweak for it)
Use LiveHTTPHeaders for firefox to see what it's really sending back.