Hi Peter,
The export code is a little different because it doesn't have a progress bar. So what it does is not going to be terribly useful to you.
For the record, the important bit that it does do is set;
p_web.HeaderDetails.ContentDisposition = 'attachment; filename="Customer.xml"'
p_web.ReplyContentType = 'application/vnd.ms-excel'
p_web.ReplyContentFixed = true
that's what makes it open in excel, and not display in the browser.
But as I say, not terribly useful because your context is different.
So, for the next build (11.38) I've added two options. So you can "force" the name the file will be downloaded as. (this needs to be set to force a download.) And a reply content type that you can set.
I can't promise the xml file will open in Excel - that's up to your browser - but it's the same as the browse export.
cheers
Bruce