P
playerbigdog
This is my code:
If mailmergeCounter = 1 Then 'Add new Workbook with PassFail
list
Workbooks.Add
Range("A1").Offset(0, 0) = "City ID"
Range("A1").Offset(0, 1) = "City Name"
Range("A1").Offset(0, 2) = "Pass"
Range("A1").Offset(0, 3) = "Fail"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=DriveVar + "PF Assessment " + YEARS +
"\" + "PF_PassFail" + YEARS + ".xlsx"
Application.DisplayAlerts = True
Range("A1").Offset(mailmergeCounter, 0) = city_id
Range("A1").Offset(mailmergeCounter, 1) = myVar5
Range("A1").Offset(mailmergeCounter, 3) = "x"
ActiveWorkbook.Save
ActiveWorkbook.Close
Else 'Open Workbook with PassFail list
Workbooks.Open Filename:=DriveVar + "PF Assessment " + YEARS + "\" +
"PF_PassFail" + YEARS + ".xls"
Range("A1").Offset(mailmergeCounter, 0) = city_id
Range("A1").Offset(mailmergeCounter, 1) = myVar5
Range("A1").Offset(mailmergeCounter, 3) = "x"
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
End If
It says i have an error when i open the file, can someone tell me what is
wrong.
If mailmergeCounter = 1 Then 'Add new Workbook with PassFail
list
Workbooks.Add
Range("A1").Offset(0, 0) = "City ID"
Range("A1").Offset(0, 1) = "City Name"
Range("A1").Offset(0, 2) = "Pass"
Range("A1").Offset(0, 3) = "Fail"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=DriveVar + "PF Assessment " + YEARS +
"\" + "PF_PassFail" + YEARS + ".xlsx"
Application.DisplayAlerts = True
Range("A1").Offset(mailmergeCounter, 0) = city_id
Range("A1").Offset(mailmergeCounter, 1) = myVar5
Range("A1").Offset(mailmergeCounter, 3) = "x"
ActiveWorkbook.Save
ActiveWorkbook.Close
Else 'Open Workbook with PassFail list
Workbooks.Open Filename:=DriveVar + "PF Assessment " + YEARS + "\" +
"PF_PassFail" + YEARS + ".xls"
Range("A1").Offset(mailmergeCounter, 0) = city_id
Range("A1").Offset(mailmergeCounter, 1) = myVar5
Range("A1").Offset(mailmergeCounter, 3) = "x"
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
End If
It says i have an error when i open the file, can someone tell me what is
wrong.