+ Reply to Thread
Results 1 to 7 of 7

[SOLVED] Need Macro To Close Excel Application

Hybrid View

  1. #1
    MarySue
    Guest

    [SOLVED] Need Macro To Close Excel Application

    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.


  2. #2
    Tushar Mehta
    Guest

    Re: Need Macro To Close Excel Application

    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.
    >
    >


  3. #3
    MarySue
    Guest

    Re: Need Macro To Close Excel Application

    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.
    > >
    > >

    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Need Macro To Close Excel Application

    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.
    > > >
    > > >

    > >




  5. #5
    Registered User
    Join Date
    09-17-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Need Macro To Close Excel Application

    Here you go...

    Application.DisplayAlerts = False
    Application.Quit

    If you just use app.quit you will be asked if you want ot save the workbook. If you wan to by pass this, turn off the display alerts.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Need Macro To Close Excel Application

    Welcome to the forum, jef.

    Pleas take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Need Macro To Close Excel Application

    Jef96

    This original post is from 2005, I think it's past it's sell by date!

    As shg says take some time to read the forum Rules that you agreed to before posting again
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1