View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Edgar Thoemmes[_4_] Edgar Thoemmes[_4_] is offline
external usenet poster
 
Posts: 16
Default Import sheet error

Hi

I am trying to use the below code to import a title page for my reports but
it is coming with the error message:
'Compile error: Object error'
On line 'Set CurrWb = ActiveWorkbook.Name'

Can anyone help resolve this?

TIA

Sub AddTitlePage()
Dim CurrWb As String
Dim TitleWb As Workbook

Set CurrWb = ActiveWorkbook.Name
Set TitleWb = Workbooks.Open("F:\Resources\Title Page.xls")

With TitleWb
..Sheets("Title").Copy Befo=Workbooks(CurrWb).Sheets(1)
..Close
End With

End Sub