G
Guest
Hi RBS,
Thank you again very much for your patience.
First of all, Line 79 is "ActiveWorkbook.SaveAs CSVDir & CSVFName,
xlCSVWindows, , , , False, xlNoChange".
Secondly, I find where the problem is, and I do not know how to solve it.
The problem is on the "CRYear".
In addition to using "CRYear" in "CSVFName", I also use it in "CSVDir".
CSVDir is the directory where the CSV file will be saved, and CSVFName is the
file name of a CSV file. The code that I posted has the CSVDir as "C:\".
Actually, it should be ""C:\" & CRYear". Due to business reason, we have CSV
files for different years. The CSV files are named combination of customer
name and the year for the CSV file (e.g. ABC2007.csv) and are saved in the
appropriate folder for the CSV year. The customer name and CSV year should
come from the input file (Workbook A). Apparently, the VBA does not like the
fact that CRYear is being used for various purpose.
I have tried to creating a new variable (DIRYear) and referencing the
DIRYear to a different cell. The code still does not work. I am still
getting the same error.
Is there a way around it? Thanks.
Thank you again very much for your patience.
First of all, Line 79 is "ActiveWorkbook.SaveAs CSVDir & CSVFName,
xlCSVWindows, , , , False, xlNoChange".
Secondly, I find where the problem is, and I do not know how to solve it.
The problem is on the "CRYear".
In addition to using "CRYear" in "CSVFName", I also use it in "CSVDir".
CSVDir is the directory where the CSV file will be saved, and CSVFName is the
file name of a CSV file. The code that I posted has the CSVDir as "C:\".
Actually, it should be ""C:\" & CRYear". Due to business reason, we have CSV
files for different years. The CSV files are named combination of customer
name and the year for the CSV file (e.g. ABC2007.csv) and are saved in the
appropriate folder for the CSV year. The customer name and CSV year should
come from the input file (Workbook A). Apparently, the VBA does not like the
fact that CRYear is being used for various purpose.
I have tried to creating a new variable (DIRYear) and referencing the
DIRYear to a different cell. The code still does not work. I am still
getting the same error.
Is there a way around it? Thanks.