I have this macro that I used when I had Excel 2003 and now it is failing under 2007. I have a workbook that has multiple sheets. I need to save each sheet as a separate .txt.file.
Can someone tell me why this is failing? The error is a runitome ‘1004’ Method ‘Copy’ of object ‘_Worksheet’ failed.
[codebox]Sub createTxt()
Dim oWS As Worksheet, oWB As Workbook
Dim strPath As String, strFName As String
strPath = “\Bl-recs-goalieprofessional_staffBudgetsAdministration9-10BudgetBudget_Upload”
For Each oWS In Worksheets
oWS.Copy
ActiveWorkbook.SaveAs Filename:=strPath & oWS.Name, FileFormat:=xlText
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Next oWS
End Sub[/codebox]
Thanks in advance!