Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have done some VBA within Module1 of my excel spreadsheet which,
amongst other things, loads up another file and copies and pastes the information into the spreadsheet. This part is fine. However, when I come to go out of the spreadsheet after I've done the copy and paste into my working one it prompts to save the file as it sees that I've done a change. I always want this prompt to be No to Save Changes. How do I do this? From reviewing other posts I've tried all of the following without avail: Application.EnableEvents = False ThisWorkbook.Saved = True ActiveWorkbook.Close savechanges = False ActiveWorkbook.Close (savechanges = False) The only 'weird' thing about the file is that it appears to have 'Read Only' attributes so I'm assuming this is why windows is forcing excel to save it as a different name. I'll never need to amend this file though and only ever need to open as read-only anyway. Would appreciate your help as always on this. I've included an extract below from the VBA which may help?!??! I've tried Step Into process with different variations of close activity, all to no avail. Thanks in advance, Al Mackay ChDir "H:\" Workbooks.Open Filename:= _ "H:\Cost Centre - Liaison Contact List.xls" Selection.AutoFilter Field:=7, Criteria1:="<" Range("A:A,G:G").Select Range("G1").Activate Selection.Copy Windows("Prepare CSV Files.xls").Activate Range("A1").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Rows("1:2").Select Range("A2").Activate Application.CutCopyMode = False Selection.Delete Shift:=xlUp Range("C1").Select Windows("Cost Centre - Liaison Contact List.xls").Activate Selection.AutoFilter Application.EnableEvents = False ThisWorkbook.Saved = True ActiveWorkbook.Close savechanges = False Application.EnableEvents = False |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I didn't test this with a Read Only file, but it appears your
syntax is slightly off. Try one of these: ActiveWorkbook.Close False ActiveWorkbook.Close SaveChanges:=False Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you save an excel file to be read as IBM-type text file ? | Excel Worksheet Functions | |||
Autoname a save as file from a cell in a read only file | Excel Discussion (Misc queries) | |||
cant save read only file | Excel Discussion (Misc queries) | |||
How to save a PC Excel file into MAC (it says file is read only)? | Excel Discussion (Misc queries) | |||
Trying to save a .XLA file that's Read Only | Excel Programming |