Reputation: 1713
I have a record set UserTab
that I want to copy to an excel spreadsheet (it has all needed formatting) and then save a copy
Dim templatewb As Workbook
templatewb = application.open("C:\ \ .xlsx") // I also tried add
templatewb.Worksheets("Sheet1").Cells("A1").CopyFromRecordset UserTab
templatewb.close savechanges:=true filename:="c:...copyOfATemplate.xls"
I get the following
Method 'Save' of object '_Workbook' failed
Upvotes: 0
Views: 82
Reputation: 166256
Dim templatewb As Workbook
Set templatewb = workbooks.open("C:\stuff\templt.xlsx") 'need Set here...
templatewb.Worksheets("Sheet1").Range("A1").CopyFromRecordset UserTab
templatewb.SaveAs "C:\stuff\copyOfATemplate.xls"
Upvotes: 3