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


Groups > comp.databases.ms-access > #10305 > unrolled thread

How to close an open excel using MS Access VBA

Started byBarry Wright <barry.edmund.wright@witstoronto.ca>
First post2015-01-24 16:23 -0800
Last post2015-02-09 18:12 -0800
Articles 3 — 3 participants

Back to article view | Back to comp.databases.ms-access


Contents

  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

#10305 — How to close an open excel using MS Access VBA

FromBarry Wright <barry.edmund.wright@witstoronto.ca>
Date2015-01-24 16:23 -0800
SubjectHow to close an open excel using MS Access VBA
Message-ID<15913c8a-80d7-44b6-8e88-9723dd533f27@googlegroups.com>
Hi,

I have an open excel spreadsheet: C:\Excel Files\Entries.xls

What is the vba code that would close this file?

Thanks,
Barry

[toc] | [next] | [standalone]


#10306

From"Phil" <phil@stantonfamily.co.uk>
Date2015-01-25 09:41 +0000
Message-ID<ma2do1$of6$1@speranza.aioe.org>
In reply to#10305
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

[toc] | [prev] | [next] | [standalone]


#10340

FromAbhijeet Gudur <gopal.abhijeet@gmail.com>
Date2015-02-09 18:12 -0800
Message-ID<da43491c-7d9d-487b-a42f-ce14ebd1e4a7@googlegroups.com>
In reply to#10305
wb -  C:\Excel Files\Entries.xls 
wb.close
set wb = nothing

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.ms-access


csiph-web