Macro Problem


Posted by Ben on July 09, 2001 7:08 AM

Guys & Gals

I'm new to this macro stuff and stuck on one I recorded. It does what I want but at the end I select a textfile, (that i've taken data from). When I run the macro it goes to close it, but instead of closing it it pops up a boxing asking if I want to save changes. I have to manually dismiss the box.
How do I code the macro to bypass this and close the textfile without saving or prompting?
Below is the relevant bit of code.

Windows("wofilelist.txt").Activate
Range("C1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("C3").Select
ActiveWindow.Close
End Sub



Posted by Ben O. on July 09, 2001 7:19 AM

Ben,

Try this as your close statement:

ActiveWindow.Close SaveChanges:=False

I've never tried it with text files, but it works for closing Excel Workbooks.

If that doesn't work, put this statement at the beginning of your macro:

Application.DisplayAlerts = False

This will stop dialog boxes from popping up, but be warned that it automatically chooses the default option.

-Ben