Mail Merge

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top