The code below has run fine in 2007, now that I have 2010, it runs through the loop up to 6 times and then crashes Excel 2010. Anyone have any ideas why this happens?
While intCount > 0
strTeam = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
strMatch = ActiveCell.Value
ActiveCell.Offset(0, -1).Select
Debug.Print strTeam
If strType = strMatch Then
strFileName = strPath & strTeam & ".xls"
Debug.Print strFileName
'Set oExcel = New Excel.Application
'Set oWB = oExcel.Workbooks.Open(strFileName)
Workbooks.Open Filename:=strFileName
strFileName = strPath & strTeam & ".xlsm"
ActiveWorkbook.SaveAs Filename:=strFileName, FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWorkbook.Close False
strFileName = strPath & strTeam & ".xlsm"
Debug.Print strFileName
Workbooks.Open Filename:=strFileName
Call StatusRptFormat(strTeam)
ActiveWorkbook.Close False
ActiveCell.Offset(0, 2).Select
ActiveCell.FormulaR1C1 = "File Created"
ActiveCell.Offset(0, -2).Select
End If
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar