Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Closing workbook open as CSV

I open a CSV file in Excel, Copy two columns of data, paste the data into
another workbook and then I want to cloes the CSV file without getting a
prompt about saving the data to the clipboard.

I am using Application.ActiveWindow.Close (False) to close the file but I'm
still getting the prompt to save the data. Is there another command I should
use?

Thanks,
Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Closing workbook open as CSV

First, I don't go through the Windows collection. I just close the workbook.

Dim CSVWkbk as workbook
'other code here

'open the csv file
Workbooks.Open Filename:="somepath\somename.csv"
set csvwkbk = activeworkbook 'the csv that was just opened

'do lots of work
'and close the workbook
csvwkbk.close savechanges:=false

And I don't get that prompt message. (Maybe you're closing the wrong window???)

If this doesn't help, try:

application.displayalerts = false
Application.ActiveWindow.Close False
application.displayalerts = true




S Shipley wrote:

I open a CSV file in Excel, Copy two columns of data, paste the data into
another workbook and then I want to cloes the CSV file without getting a
prompt about saving the data to the clipboard.

I am using Application.ActiveWindow.Close (False) to close the file but I'm
still getting the prompt to save the data. Is there another command I should
use?

Thanks,
Sam


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Closing workbook open as CSV

Hi Sam,

In addition to Dave's first sample:

'open the csv file
Workbooks.Open Filename:="somepath\somename.csv"
set csvwkbk = activeworkbook 'the csv that was just opened


'do lots of work

'mislead the workbook it is saved after changes
csvwkbk.saved = true

'and close the workbook
csvwkbk.close savechanges:=false


HTH,

Wouter
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Closing workbook open as CSV

I don't recall ever having to mislead excel if I closed without saving changes.

But if it helps the original poster, woohoo!!!

Wouter HM wrote:

Hi Sam,

In addition to Dave's first sample:

'open the csv file
Workbooks.Open Filename:="somepath\somename.csv"
set csvwkbk = activeworkbook 'the csv that was just opened

'do lots of work

'mislead the workbook it is saved after changes
csvwkbk.saved = true

'and close the workbook
csvwkbk.close savechanges:=false

HTH,

Wouter


--

Dave Peterson
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
projects left open in vba after closing workbook Gary Keramidas Excel Programming 4 July 26th 09 10:14 AM
how i open another sheet in the same workbook without closing? kamrul Excel Discussion (Misc queries) 2 February 14th 09 08:31 AM
Keeping program open even when closing workbook Bob Excel Discussion (Misc queries) 3 April 25th 08 07:55 PM
Closing an open workbook Dan Excel Programming 3 August 16th 06 08:54 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 04:46 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"