View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don S Don S is offline
external usenet poster
 
Posts: 12
Default Close workbook problem

I have the following code where I open a workbook, copy page and close
workbook. Excel is "locking up" (hourglass) at close workbook line. I have
used this same code in other applications with no problem. Any ideas?

Sheets("Directory").Select
Yr = Cells(2, 2)
Mth = Cells(4, 2)
Location = Cells(7, 2)
CAFile = Cells(8, 2)
ctpage = Cells(9, 2)
CTup = Cells(14, 2)

Dim bk As Workbook
Set bk = Workbooks.Open(Location & Yr & "\" & Mth & "\" & CAFile,
UpdateLinks:=False)


Dim wbkSource As Workbook
Dim wbkDestination As Workbook
Dim wksSource As Worksheet
Dim wksDestination As Worksheet
Dim rngSource As Range
Dim rngDestination As Range

Set wbkSource = Workbooks(CAFile)
Set wksSource = wbkSource.Sheets(ctpage)
Set rngSource = wksSource.Cells

Set wbkDestination = ThisWorkbook
Set wksDestination = wbkDestination.Sheets(CTup)
Set rngDestination = wksDestination.Range("A1")

rngSource.Copy
rngDestination.PasteSpecial (xlPasteValues)


Windows(CAFile).Activate
Application.DisplayAlerts = False
ActiveWorkbook.Close SaveChanges:=False
Application.DisplayAlerts = True