View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dr chuck dr chuck is offline
external usenet poster
 
Posts: 74
Default copying and pasting to a different xls file in a different directo


the following syntax.. creates the apporpriate file "s" and opens it and
gets me to the correct range. It however will not paste the information that
was selected and copied. It gives me an error every time on
ACTIVESHEET.PASTE. I get "run time error 1004".. paste method of worksheet
class failed.

Private Sub test2_Click()
Range("C40:E40").Select
Selection.Copy

Dim s As String, bk As Workbook

s = Range("othermanufact").Value & "-" & Range("lot").Value & "-" &
Format(Range("exp").Value, "mmddyyyy") & ".xls"
Set bk = Workbooks.Add()
bk.SaveAs "C:\Program Files\PanelSelect\panels\" & s


Workbooks.Open Filename:= _
"C:\Program Files\PanelSelect\panels\" & s

ActiveWindow.Visible = True


Windows(s).Activate

Sheets("Sheet1").Range("c2").Activate

ActiveSheet.paste <===error here every time

End Sub




help
dr chuck