Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default File to close itself and the current instance of XL

Using Office 2003 and Windows XP.

I have an Excel file that is designed to open, run some code and then close
itself and the current instance of the application that was started when the
file was opened.

Could someone please save my life and post some generic example VBA
illustrating how to do this or, better yet, modify my existing code below?
(If possible, I need this rather soon...)

My current code closes the file, but not the Application:

Dim oThisWorkBook As Workbook
<Other code
oThisWorkBook.Close SaveChanges:=False

Thanks much in advance for your much needed assistance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default File to close itself and the current instance of XL

'quit without any question
application.displayalerts=false
application.quit


"XP" wrote:

Using Office 2003 and Windows XP.

I have an Excel file that is designed to open, run some code and then close
itself and the current instance of the application that was started when the
file was opened.

Could someone please save my life and post some generic example VBA
illustrating how to do this or, better yet, modify my existing code below?
(If possible, I need this rather soon...)

My current code closes the file, but not the Application:

Dim oThisWorkBook As Workbook
<Other code
oThisWorkBook.Close SaveChanges:=False

Thanks much in advance for your much needed assistance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default File to close itself and the current instance of XL

Thanks, but this doesn't work. The file closes and leaves the Application up.


"Vergel Adriano" wrote:

'quit without any question
application.displayalerts=false
application.quit


"XP" wrote:

Using Office 2003 and Windows XP.

I have an Excel file that is designed to open, run some code and then close
itself and the current instance of the application that was started when the
file was opened.

Could someone please save my life and post some generic example VBA
illustrating how to do this or, better yet, modify my existing code below?
(If possible, I need this rather soon...)

My current code closes the file, but not the Application:

Dim oThisWorkBook As Workbook
<Other code
oThisWorkBook.Close SaveChanges:=False

Thanks much in advance for your much needed assistance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default File to close itself and the current instance of XL

Instead of closing the workbook:

ThisWorkbook.Saved = True
Application.Quit

The workbook will close when the application quits.

"XP" wrote:

Thanks, but this doesn't work. The file closes and leaves the Application up.


"Vergel Adriano" wrote:

'quit without any question
application.displayalerts=false
application.quit


"XP" wrote:

Using Office 2003 and Windows XP.

I have an Excel file that is designed to open, run some code and then close
itself and the current instance of the application that was started when the
file was opened.

Could someone please save my life and post some generic example VBA
illustrating how to do this or, better yet, modify my existing code below?
(If possible, I need this rather soon...)

My current code closes the file, but not the Application:

Dim oThisWorkBook As Workbook
<Other code
oThisWorkBook.Close SaveChanges:=False

Thanks much in advance for your much needed assistance.

Reply
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
Close Explorer Instance Shawn G. Excel Programming 0 April 19th 06 04:38 PM
Close Current File Then Open New file Steve Roberts Excel Programming 1 March 31st 05 02:08 AM
Retrieving Current Excel Instance from Automation Add-IN mduncan Excel Programming 2 March 11th 05 10:49 PM
Is it possible to prevent opening of workbooks in the current instance of Excel? [email protected] Excel Programming 0 January 26th 05 09:41 PM
Close second instance of excel Neil[_11_] Excel Programming 2 December 22nd 03 03:39 AM


All times are GMT +1. The time now is 05:02 PM.

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

About Us

"It's about Microsoft Excel"