I am writing VBA in access controlling Excel. I need to open a new workbook and copy the first sheet, called Summary into a new sheet in the new workbook and then save the new workbook. I keep getting an error saying "Copy method of Worksheet class failed"
Here is my copy code below:
Set xlapp = New Excel.Application
xlapp.Visible = True
Set reportbook = xlapp.Workbooks.Add
scrapbook.Worksheets("Summary").Copy_
Before:=reportbook.Worksheets(1)
I have tried tio use the name of a worksheet also when referencing the reportbook.
Any ideas are MUCH appreciated.
Thanks!!
Here is my copy code below:
Set xlapp = New Excel.Application
xlapp.Visible = True
Set reportbook = xlapp.Workbooks.Add
scrapbook.Worksheets("Summary").Copy_
Before:=reportbook.Worksheets(1)
I have tried tio use the name of a worksheet also when referencing the reportbook.
Any ideas are MUCH appreciated.
Thanks!!