Clear Clipboard after Copy

C

Connie

I am using the following code to cut and paste data from a csv file
into a sheet within a workbook. The problem is that when I close the
csv file, I get prompted as to whether or not I want to save the
contents of the clipboard as the clipboard contains a large amount of
data. How do I clear the clipboard to avoid this prompt? Any help
would be appreciated. Thanks!

Connie
****************************************************************************************************************
Set wkbk = ActiveWorkbook
Set sh = Worksheets("Employee List")
Set wb = Workbooks.Open(FileName:= _
"C:\Documents and Settings\Connie Maldonado\My
Documents\Mastec\Employee List\hourly employees.csv")
wb.Worksheets(1).Cells.Copy
wkbk.Worksheets("Employee List").Cells.PasteSpecial
Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
wb.Close savechanges:=False
 
C

Chad

Connie said:
I am using the following code to cut and paste data from a csv file
into a sheet within a workbook. The problem is that when I close the
csv file, I get prompted as to whether or not I want to save the
contents of the clipboard as the clipboard contains a large amount of
data. How do I clear the clipboard to avoid this prompt? Any help
would be appreciated. Thanks!

Connie
****************************************************************************************************************
Set wkbk = ActiveWorkbook
Set sh = Worksheets("Employee List")
Set wb = Workbooks.Open(FileName:= _
"C:\Documents and Settings\Connie Maldonado\My
Documents\Mastec\Employee List\hourly employees.csv")
wb.Worksheets(1).Cells.Copy
wkbk.Worksheets("Employee List").Cells.PasteSpecial
Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
wb.Close savechanges:=False
 
M

marcus

Hi Alan

I would solve the problem by putting the following code near the top of
your macro;

Application.DisplayAlerts = False

regards

Marcus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top