Using the AutoFitColumns method for Excel SS created from ASP page



I am attempting to 'autofit' the columns in an excel (2003) spread*** that
I have created from an ASP page. Unfortunately, all attempts to autofit the
columns to the data have failed thus far.

Here's the code (minus the SQL that retrieves the data) ...
--
<SCRIPT LANGUAGE="VBScript">

sub button1_onclick()

' Launch Excel
dim app
set app = createobject("Excel.Application")

' Make it visible
app.Visible = true

' Add a new workbook
dim wb
set wb = app.workbooks.add

dim arr(300,5)

' Set up first row in work***

arr(0,0) = "Prio"
arr(0,1) = "Recipient"
arr(0,2) = "Purpose"
arr(0,3) = "Description"
arr(0,4) = "rQty"
arr(0,5) = "dtRequest"

<%
'Get Data with SQLQuery
%>

Set RequestData = DBconnection.Execute(SQLQuery)
While Not RequestData.EOF
prio = RequestData("Priority")
recipient = RequestData("recipient")
purpose = RequestData("ReqPurpose")
comment = RequestData("comment")
rqty = RequestData("rqty")
dtrequest = RequestData("dtrequest")
%>
arr(<%=n%>,0) = "<%=prio%>"
arr(<%=n%>,1) = "<%=recipient%>"
arr(<%=n%>,2) = "<%=purpose%>"
arr(<%=n%>,3) = "<%=comment%>"
arr(<%=n%>,4) = "<%=rqty%>"
arr(<%=n%>,5) = "<%=dtrequest%>"
<%
n = n + 1

RequestData.Movenext
Wend
%>

' Declare a range object to hold our data
dim rng
set rng = wb.Active***.Range("A1").Resize("<%=n%>","6")

' Now assign them all in one shot...
rng.value = arr

' Set a variable to the used range in the active ***.
Set rngUsedRange = wb.Active***.UsedRange.select

' Autofit the columns.
rngUsedRange.AutoFitColumns

' Give the user control of Excel
app.UserControl = true

end sub
</SCRIPT>
--

Thanks for any suggestions that may solve this problem,
-Raul
.