ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening and closing text files (https://www.excelbanter.com/excel-programming/274155-opening-closing-text-files.html)

Vince[_3_]

Opening and closing text files
 
I am opening a text file that is tab delimited via VBA
code. After I copy the data that I want to copy, then
select the current active worksheet and paste the data, I
close the text file. When I close the text file, I always
get the message

"There is a large amount of data on the clipboard, do you
want to save the data...yes, no, cancel".

Is there a way to close the file without having to answer
this question each time?

Any ideas would be appreciated.

Vince

steve

Opening and closing text files
 
Vince,

There are 2 ways:

Use -
Application.Displayalerts = False at the beginning of the code
and
Application.Displayalerts = True at the end.

also include
Application.CutCopyMode = False
after the paste (to clear the clipboard)

steve


"Vince" wrote in message
...
I am opening a text file that is tab delimited via VBA
code. After I copy the data that I want to copy, then
select the current active worksheet and paste the data, I
close the text file. When I close the text file, I always
get the message

"There is a large amount of data on the clipboard, do you
want to save the data...yes, no, cancel".

Is there a way to close the file without having to answer
this question each time?

Any ideas would be appreciated.

Vince





All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com