LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default closing excel

hi
i have the following module that opens excel copies the contents of the
sheet to a table, cleans the sheet and closes the workbook
all working fine up to now
I then quit XL this happens but after a few seconds i get a message
box telling me that my Xlsheet is now available for editing
how do i stop this ???


Public Sub WorkbookOpen()
Dim XL As Object, XLBook As Object, MyProjectPath As String
Dim XLsheet As Excel.Worksheet
DoCmd.SetWarnings False
MyProjectPath = "C:\Temp\Daily_info.xls"
If Dir(MyProjectPath) = "" Then GoTo Exit_Sub_WorkbookOpen
Set XL = CreateObject("Excel.Application")
Set XLBook = XL.Workbooks.Open("C:\Temp\Daily_info.xls")
XL.Worksheets(1).Activate
XL.Visible = True
'COPYING THE DATA
DoCmd.RunMacro "running_Getting_data_withoutwarnings"
Set XLsheet = XL.Worksheets("Daily_info")
'CLEARING THE CONTENTS
XLsheet.Range("A2:G500").ClearContents
XLBook.Close SaveChanges:=True
XL.Quit
DoCmd.SetWarnings True
Exit_Sub_WorkbookOpen:
Set XLsheet = Nothing
Set XLBook = Nothing
Set XL = Nothing
End Sub


many thanks


kevin

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
Closing Excel RVarner New Users to Excel 1 May 24th 09 04:06 PM
Closing Excel Diane Excel Discussion (Misc queries) 2 March 24th 05 07:27 PM
Closing VB triggers closing Excel Minilek Excel Programming 2 August 6th 04 05:17 PM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"