View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sharon Sharon is offline
external usenet poster
 
Posts: 183
Default error "Set wb = Workbooks(FilePathName)"

I'm sorry, wasn't sure how to catagorize this in the subject line.........
I'm trying to copy tabs from a non-active workbook and paste them to an
active workbook, however I must be doing this all wrong.
Can anyone help me? Thanks.




Dim FilePathName As String
FilePathName = "Q:\Finance\Forecast\2007\" & TimePeriod & "\Cons Fin\" &
strName & ".xls"

'clears/resets objects for finding latest modified file
Set oFSO = Nothing
Set oFile = Nothing
Set oFolder = Nothing


' copy ConsFin Tabs to Tri Interest & Interco Report
Dim wb As Workbook
Set wb = Workbooks(FilePathName)
wb.Sheets(5).Copy ActiveWorkbook.Sheets("TRI - Dec Int Inc")
wb.Sheets(7).Copy ActiveWorkbook.Sheets("TRI - Int Abov EBITDA")
wb.Close True
Set wb = Nothing