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: 4
Default Closing excel from a macro

I am currently opening excel from a java application. I use the excel object
(this workbook) to run several macros. The java application opens excel, so
every time excel is opened, some code must be run and then excel must be
close. The code I am trying to use is:

Private Sub Workbook_Open()
Macro1
tbmfile = "C:\excelfile.xls"
tbmxcelfile = "excelfile"
Windows(tbmxcelfile).Activate
ActiveWorkbook.Save
Application.Quit

If I step through this code it works fine and closes excel. But when I open
excelfile.xls from my documents, the macros are triggered to run, but excel
does not close. Why is that?
 
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
Macro Code for closing excel... Bonbon[_4_] Excel Programming 5 April 12th 06 12:57 PM
Prevent running macro upon closing Excel Deneb Excel Programming 2 February 2nd 05 06:07 PM
Closing excel with a macro TJexcel Excel Programming 1 December 8th 04 07:42 AM
Closing Excel from a Macro Jimmy Excel Programming 6 August 20th 04 02:25 AM
Closing Excel down with a macro? andycharger[_28_] Excel Programming 2 May 6th 04 04:18 PM


All times are GMT +1. The time now is 11:40 AM.

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"