Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default File and Don't save changes - Read Only File

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default File and Don't save changes - Read Only File

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you save an excel file to be read as IBM-type text file ? Dee Franklin Excel Worksheet Functions 2 October 10th 06 02:46 AM
Autoname a save as file from a cell in a read only file g4rod Excel Discussion (Misc queries) 2 October 6th 06 01:16 PM
cant save read only file pglm Excel Discussion (Misc queries) 2 September 15th 06 02:02 PM
How to save a PC Excel file into MAC (it says file is read only)? claudiosissa Excel Discussion (Misc queries) 0 November 30th 05 01:57 AM
Trying to save a .XLA file that's Read Only silkworm Excel Programming 4 November 12th 05 01:22 AM


All times are GMT +1. The time now is 10:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"