Question : EXCEL VBA  - Application.CutCopyMode = False not Clearing Clipboard?


Hi Guys,

Using the code below to Copy and paste special some values from one workbook to another.
Getting the "Large aount of data on Clipboard would like to save this .. etc etc" msg box each time, despite have the "Application.CutCopyMode = False" straight after the paste.
The Pop up is apearing at the "wbk.Close False" line in the code.

Any idea's?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
Private Sub CommandButton19_Click()
' Import data from Lab Capacity Model'
 
 
Dim rng As Range
Dim objExcel As New Excel.Application
Dim AppExc As Excel.Application
Dim MyPath As String
 
 
MyPath = ThisWorkbook.Path
 
 
Set wbk = objExcel.Workbooks.Open(MyPath & "\Lab Capacity Model.xls")
Set wks = wbk.Sheets("Batches Record")
Set rng = wks.Range("A2:P5000")
 
Sheets("Batch Record LCM").Range("A2:Q5000").ClearContents
 
 
rng.Copy
Sheets("Batch Record LCM").Range("A2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
 
 
 
wbk.Close False
   Set wks = Nothing
   Set wbk = Nothing
   Set objExcel = Nothing

Answer : EXCEL VBA  - Application.CutCopyMode = False not Clearing Clipboard?

Random Solutions  
 
programming4us programming4us