Using COM to Create an Excel Spreadsheet from ColdFusion
I am using COM via a ColdFusion site to create an excel file with multiple
worksheets. Each worksheet needs to contain a different web query. I was able
to successfully create the file and the worksheets, but I am having trouble
setting cell values and creating the web queries. Here is the code I used...
The following block of code is supposed to create a new worksheet, name it,
and add a web query to a url...
<cfscript
// Add a new worksheet (this will contain our data)
objWorkSheet = objWorkSheets.Add();
objWorkSheet.Name = "#profileKey#";
objQueryTables = objWorksheet.QueryTables;
objQueryTable = objQueryTables.Add("#url#", objRange);
objQueryTable.Refresh();
</cfscript
The line to add the new query table is failing.
After the new worksheets containing the web queries are created, a final
worksheet is added, which will contain a summary of the other sheets. I am
having trouble setting the value of a cell.
myRange = objExcel.Range("A1:A1");
myRange.value = "My Value";
I would really appreciate any help I can get on this topic.
Thanks!
|