Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts

    How do I close Excel from VB?

    I am using Visual Studio Express to open a spreadsheet, manipulate data and close it. The spreadsheet closes, but leaves Excel there. How do I actually close off Excel itself?

    The open code is:

    Code:
            xlsApp = CreateObject("Excel.Application")
            xlsApp.Visible = False
    
            xlsWB1 = xlsApp.Workbooks.Open("c:\invoicing\Brazil Param-file.xlsx")
            xlsWS1 = xlsWB1.Worksheets("Values")
    I close the spreadsheet with

    Code:
            xlsWB1.close(savechanges:=true)
    There is obviously, one more command I need, but I'm not experienced enough to know what it is, so I'm asking the experts

    Thanks

    Alan

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Try
    xlsApp.Quit

    Steve

  3. The Following User Says Thank You to sdckapr For This Useful Post:

    alan sh (2013-11-13)

  4. #3
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    Thanks.

    Alan

Posting Permissions

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