Click to See Complete Forum and Search --> : Avoid a message when closing Excel File
Chien9999
Jun 16th, 2003, 03:13 AM
Hi, There
I am creating a macro.
The macro open a file, copy an area & paste to another area.
The this file to be closed. But I always have a massage (See file attached) . This will delay the process as I have to choose "Yes" or "No".
My Question : How do I avoid this message.
Thank you for your help.
JCScoobyRS
Jun 16th, 2003, 09:30 AM
objExcel.DisplayAlerts = False
objExcel is the Excel.Application. HTH, Jeremy
P.S. - If you need more assistance, let me know.
Chien9999
Jun 16th, 2003, 09:44 PM
Thanks for your reply. In fact I do not understand clearly.
Can you add to this macro so that the message is not shown :
Sub XX()
Workbooks.Open Filename:="C:\SAPworkdir\tg1.xls"
Range("A1:C500").Select
Selection.Copy
Windows("CL.xls").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Windows("tg1.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Thanks a lot
writelearner
Jun 17th, 2003, 02:09 AM
what i usually do is that i copy an empty cell befor quiting
and if you don't want to save you type this instead of ActiveWorkbook.Save
Active workbook.saved = true
visual basic code:--------------------------------------------------------------------------------
Sub XX()
Workbooks.Open Filename:="C:\SAPworkdir\tg1.xls"
Range("A1:C500").Copy
Windows("CL.xls").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Windows("tg1.xls").Activate
Range("D1").copy
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
--------------------------------------------------------------------------------
pour une fois que je peux aider:D
JCScoobyRS
Jun 17th, 2003, 09:07 AM
What you need to add to your macro is this:
Application.DisplayAlerts = False
I neglected to remember you were doing VBA and not VB. Put that line anywhere in your macro before saving and closing. Let me know, Jeremy
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.