Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #10306

Re: How to close an open excel using MS Access VBA

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: How to close an open excel using MS Access VBA
Date 2015-01-25 09:41 +0000
Organization Aioe.org NNTP Server
Message-ID <ma2do1$of6$1@speranza.aioe.org> (permalink)
References <15913c8a-80d7-44b6-8e88-9723dd533f27@googlegroups.com>

Show all headers | View raw


On 25/01/2015 00:23:19, Barry Wright wrote:
> Hi,
> 
> I have an open excel spreadsheet: C:\Excel Files\Entries.xls
> 
> What is the vba code that would close this file?
> 
> Thanks,
> Barry
> 

Try

    Dim MyXL As Object

This bit opens the Excel application

       Set MyXL = CreateObject("Excel.Application")
       MyXL.Application.Visible = True
       Workbooks.Add

This bit closes it

       ActiveWorkbook.SaveAs Path
       MyXL.Application.Quit
       Set MyXL = Nothing

Path is the full path of the Excel file

Phil

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to close an open excel using MS Access VBA Barry Wright <barry.edmund.wright@witstoronto.ca> - 2015-01-24 16:23 -0800
  Re: How to close an open excel using MS Access VBA "Phil" <phil@stantonfamily.co.uk> - 2015-01-25 09:41 +0000
  Re: How to close an open excel using MS Access VBA Abhijeet Gudur <gopal.abhijeet@gmail.com> - 2015-02-09 18:12 -0800

csiph-web