ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using COM to Create an Excel Spreadsheet from ColdFusion (https://www.excelbanter.com/excel-programming/338730-using-com-create-excel-spreadsheet-coldfusion.html)

Matt Connolly

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!

Bob Phillips[_6_]

Using COM to Create an Excel Spreadsheet from ColdFusion
 
Where is objRange defined in the first part?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Matt Connolly" <Matt wrote in message
...
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!





All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com