This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Here is my dilemma, boiled down to a simple example. I'm trying to write to a range of cells on a given sheet. In my output tool, I'm using this:
It works splendid! However, I need to do the same thing for xls files. That exact syntax for xls files yields this error:
Error: Output Data (3): DataWrap2OleDb::SendBatch: Microsoft JET Database Engine: Cannot expand named range.\3434 = -329847722
Insert into `New Sheet$B2:C500`(`Field1`,`Field2`) Values (?,?)
Oddly enough, it does write out the column headers and the first row of data. If anyone can show me how to write out to a range of cells (not a named range) in xls, I would be much appreciative! I've attached my simple example.
Mark, I forgot to mention this is in an analytic app setup where the user is giving me a xls file from their machine. I don't think it would be easy to add a named range.
As an example of what I'm trying to accomplish, the user may have a file with numerous columns but one of them will be will be a state code. My app will let the user select that file and tell me which column is the state code. Then I will run my app and produce the number of insurance policies for each state. Instead of saving the results out to another tab, I thought it would be cool to save the results back out to the same tab by adding another column. It would also keep the user's formats on their original data, with my one column just tacked on at the end. I've got it working for xlsx files and it looks really good. Unfortunately, I can't figure it out for xls files.