View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Horatio J. Bilge, Jr. Horatio J. Bilge, Jr. is offline
external usenet poster
 
Posts: 135
Default CutCopyMode=False does not work

I am using vba in one workbook to make changes in a target workbook. I used
application.cutcopymode=false to clear the clipboard, but it doesn't seem to
work correctly. I have the clipboard visible to the side of the window, and
all of the copy/paste operations remain in the clipboard.

Here is the code I am using:
Option Explicit
Sub auto_open()
Dim FileName As Variant
Application.ScreenUpdating = False

FileName = Application.GetOpenFilename
If FileName = False Then Exit Sub

Dim WB As Workbook
Set WB = Workbooks.Open(FileName)

ThisWorkbook.Worksheets("Sheet1").Activate
ActiveSheet.Cells.Copy
WB.Worksheets("Sheet1").Range("A1").PasteSpecial
WB.Worksheets("Sheet2").Range("A3:D3").Copy
WB.Worksheets("Sheet2").Range("A4:D4").PasteSpecia l xlPasteFormats
WB.Worksheets("Sheet2").Range("B5:G5").Copy
WB.Worksheets("Sheet2").Range("B7:G9").PasteSpecia l xlPasteFormats
Application.CutCopyMode = False
WB.Worksheets("Sheet1").Activate
ActiveSheet.Range("A1").Select
Application.CutCopyMode = False
Application.ScreenUpdating = True
ThisWorkbook.Close savechanges:=False
End Sub