View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default cut to matching sheet problem

I think my previous reply still applies, so I'll wait until you answer that.

Regards

Bob

"Robert Hargreaves" wrote in message
...
I have used code like this to try to get around the problem

Path = ThisWorkbook.Path & "\"
Name = Mid(ThisWorkbook.Name, 1, Len(ThisWorkbook.Name) - 4)

Set wsArchive = Application.Workbooks(Path & Name &
"Archive.xls").Sheets(ActiveSheet.Name)
'also tried

'Set wsArchive = Workbooks(Path & Name &
"Archive.xls").Sheets(ActiveSheet.Name)

I am getting an error on the Set wsArchive Line.

I have tried the code like this to test the Path & Name variables and they
work to open the worksheet

Path = ThisWorkbook.Path & "\"
Name = Mid(ThisWorkbook.Name, 1, Len(ThisWorkbook.Name) - 4)

Application.Workbooks.Open (Path & Name & "Archive.xls")

This works and opens the relevant file why does it not write to it when
used in the different code?

Thanks
Rob