View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wtpcomplab wtpcomplab is offline
external usenet poster
 
Posts: 16
Default use a macro to close a file

The you for your answer.
The previous posting from Bob P. is a bit more in line as all I needed to do
was to clear the clipboard.
This way I do not need to remember to reset the Message Alert system.

Dan


"quartz" wrote:

Try placing the following before the point that the prompt is generated:

Application.DisplayAlerts = False

Be sure to reset it at the end of your code as follows:

Application.DisplayAlerts = True

Hope this helps.


"wtpcomplab" wrote:

I have a macro set in 1 workbook that opens a different workbook, copies
information to past into the first workbook then closes the second workbook.
My problem is how do I set the close command to close the second file
without the system message about data on the clipboard - save yes or no?
See code below.
Thank you in advance Dan

Sub Load_Group()
'
GroupNum = Application.InputBox(prompt:=" ENTER A GROUP NUMBER",
Type:=1)
Dim GrpNum As String
GrpNum = GroupNum & ".xls"

ChDir "C:\DATA FILES"
Workbooks.Open Filename:= _
"C:\DATA FILES\Print Out #" & (GrpNum)
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Windows("Invoice_AND_Total_Sheet.xls").Activate
Range("AH3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("Print Out #" & (GrpNum)).Activate
ActiveWorkbook.Close
Range("A1").Select
Calculate
End Sub