Assume this code is in the ActiveWorkbook. If so, when you close the
workbook, the code stops running. So you need to depend on Excel to close
the workbook:

Sub Auto_Open()
'
' Auto_Open and Auto_Close Macro
' Macro recorded 11/14/2004 by MarySue
'

'
Range("D2").Select
ActiveWorkbook.XmlMaps("OrderFile_Map").DataBinding.Refresh
ActiveWorkbook.Save
Application.Quit

End Sub

--
Regards,
Tom Ogilvy

"MarySue" <MarySue@discussions.microsoft.com> wrote in message
news:FBB42D18-2C50-4CB6-B3A2-DABF7B01453C@microsoft.com...
> Thanks Tushar..but one more question. Following is the code, but I can't

get
> the app to close. Can you help?
>
> Sub Auto_Open()
> '
> ' Auto_Open and Auto_Close Macro
> ' Macro recorded 11/14/2004 by MarySue
> '
>
> '
> Range("D2").Select
> ActiveWorkbook.XmlMaps("OrderFile_Map").DataBinding.Refresh
> ActiveWorkbook.Save
> ActiveWorkbook.Close
> Application.Quit
>
> End Sub
>
> Thanks in advance for your help
>
> "Tushar Mehta" wrote:
>
> > Application.Quit
> >
> > --
> > Regards,
> >
> > Tushar Mehta
> > www.tushar-mehta.com
> > Excel, PowerPoint, and VBA add-ins, tutorials
> > Custom MS Office productivity solutions
> >
> > In article <2C6E7E08-DAEF-4D88-B83B-38BFB9DB9B3E@microsoft.com>,
> > MarySue@discussions.microsoft.com says...
> > > I use "Scheduled Tasks" to open Excel and them populate the fields

with an
> > > XML file that I download daily via an FTP site. I have been able to

open the
> > > XML file and transform it to an Excel foramt that is then imported

into
> > > Access for database management. It works great!
> > >
> > > After I run the macro to run Excel and import the XML data and save

the
> > > file, it then "closes" the file. But, I would also like to "close"

the excel
> > > application until it is needed the next day.
> > >
> > > After I"close" the wooksheet, how can I "close" the Excel application?
> > >
> > > Thanks in advance your your assistance.
> > >
> > >

> >