M
mralmackay
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
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