Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
I have a macro to print the xls file, but before i print the file i want to close the file and the excel ?? How can i do ?? its possible ?? -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
Use ontime in the BeforePrint event to schedule a macro to run that will
close excel. -- Regards, Tom Ogilvy "rvillanueva" wrote in message ... I have a macro to print the xls file, but before i print the file i want to close the file and the excel ?? How can i do ?? its possible ?? -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
Try something like;
Dim xlApp Dim xlBook Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Open("C:\data\excel\TrainLoading.x lt") xlApp.Sheets("Data").Range("e1") = readdate1 xlApp.Sheets("Data").Range("e2") = Forms!frmLoading.opt1.Value xlApp.Run "BothPrint" 'xlApp.Application.Visible = True xlBook.Close (False) xlApp.Quit Set xlApp = Nothing Set xlBook = Nothing -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "rvillanueva" wrote: | | I have a macro to print the xls file, but before i print the file i want | to close the file and the excel ?? | | How can i do ?? its possible ?? | | | -- | rvillanueva | ------------------------------------------------------------------------ | rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 | View this thread: http://www.excelforum.com/showthread...hreadid=537635 | |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
Just to add, if you have a macro in the workbook being printed that is doing
the printing, as soon as you close the workbook, the macro stops. -- Regards, Tom Ogilvy "rvillanueva" wrote in message ... I have a macro to print the xls file, but before i print the file i want to close the file and the excel ?? How can i do ?? its possible ?? -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
Tom: 1) Im a rookie using macros, how can i do to use an event ? Use ontime in the BeforePrint event to schedule a macro to run that will close excel. 2) I run the macro and when i print the sheet alway ask me for the printer and all the normal params (copy, etc), how can i do to send in auto way to the default printer ? 3) If i understand when i close the xls, the macro stops then the excel still active no ?? Thanks Ricardo -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
See Chip Pearson's page on Events for an overview and his page on Ontime
http://www.cpearson.com/excel/events.htm http://www.cpearson.com/excel/ontime.htm ActiveWorkbook.Printout or ActiveSheet.Printout don't raise any dialogs for me. -- Regards, Tom Ogilvy "rvillanueva" wrote in message ... Tom: 1) Im a rookie using macros, how can i do to use an event ? Use ontime in the BeforePrint event to schedule a macro to run that will close excel. 2) I run the macro and when i print the sheet alway ask me for the printer and all the normal params (copy, etc), how can i do to send in auto way to the default printer ? 3) If i understand when i close the xls, the macro stops then the excel still active no ?? Thanks Ricardo -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Close a File and Excel ??
Thanks for your help, Ricardo -- rvillanueva ------------------------------------------------------------------------ rvillanueva's Profile: http://www.excelforum.com/member.php...o&userid=28814 View this thread: http://www.excelforum.com/showthread...hreadid=537635 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Everytime i close an excel file, it creates a new backup file | Excel Discussion (Misc queries) | |||
Close Second Version of Excel file | Excel Discussion (Misc queries) | |||
File close excel does not ask me to save changes | Excel Discussion (Misc queries) | |||
How to Close the entire Excel File | Excel Programming | |||
programmatically close help file before Excel closes? | Excel Programming |