Foros del Web » Programando para Internet » ASP Clásico »

Guardar fichero excel con asp (URGENTE!!!)

Estas en el tema de Guardar fichero excel con asp (URGENTE!!!) en el foro de ASP Clásico en Foros del Web. Hola, Tengo creada una función que me genera a partir de los datos un fichero excel, pero al hacer el método Save ignora el parámetro ...
  #1 (permalink)  
Antiguo 17/12/2003, 13:28
 
Fecha de Ingreso: diciembre-2003
Mensajes: 3
Antigüedad: 21 años, 4 meses
Puntos: 0
Guardar fichero excel con asp (URGENTE!!!)

Hola,

Tengo creada una función que me genera a partir de los datos un fichero excel, pero al hacer el método Save ignora el parámetro que le paso para el path y el nombre y me lo guarda con el nombre que le da la gana (formado por números y letras)


¿A parte del Excel y el Web Component Server necesito tener instalado algo mas en el servidor?
NO encuentro diferencias entre un servidor u otro.

El código de mi función es el siguiente:

sub crear_document_excel(byval capcalera, byval dades, byval subcarpeta, byval document, byref missatge)
On Error resume next
missatge=""
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True
Set ExcelBook = ExcelApp.Workbooks.Add


'Fulla excel amb la taula de resultats
x=1
y=1
if isarray(capcalera) then
for i=0 to ubound(capcalera)
ExcelBook.Worksheets(1).Cells(x, y).Font.Bold = true
ExcelBook.Worksheets(1).Cells(x, y).Value = capcalera(i)
y= y+1
next
else
missatge=Err.Description
end if
fila=1

if isarray(dades) then
for i=0 to ubound(dades,2)
if dades(0,i)<>"" then
fila = fila + 1
for j=0 to ubound(dades,1)
if dades(j,i)<>"" then
ExcelBook.Worksheets(1).Cells(i+2,j+1).Value=dades (j,i)
end if
next
end if
next

ExcelBook.Worksheets(1).name="Resultats"

'Calcul limit inferior de la fulla excel

col = ubound(dades,1) + 1
resto = col mod len(baseColumna)
entero = (col - resto)/len(baseColumna)
limitInferior = ""
if entero > 0 then
limitInferior=mid(baseColumna,entero,1)
end if
if resto > 0 then
limitInferior = limitInferior & mid(baseColumna,resto,1)
end if
limitInferior = limitInferior & cstr(fila)


'Fulla excel amb el gràfic
ExcelBook.Charts.Add
ExcelBook.ActiveChart.ChartType=xlBarClustered
ExcelBook.ActiveChart.SetSourceData ExcelBook.Worksheets(1).Range("B2:" & limitInferior),xlColumns

' 'Eliminar les series que hi ha per defecte fins a deixar només 1
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete
ExcelBook.ActiveChart.SeriesCollection(2).Delete

'Insertar titol al gràfic
ExcelBook.ActiveChart.HasTitle=true
ExcelBook.ActiveChart.SeriesCollection(1).Name="Gr àfic"
'Eliminar legenda
ExcelBook.ActiveChart.HasLegend=False

'Insertar titol als eixos
ExcelBook.ActiveChart.Axes(xlCategory, xlPrimary).HasTitle = True
ExcelBook.ActiveChart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Alumnes"
ExcelBook.ActiveChart.Axes(xlValue, xlPrimary).HasTitle = True
ExcelBook.ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Resultats"
else
missatge=Err.Description
end if

if Err=0 then
path = obtenir_path
path = path & "Resultados\" & subcarpeta & "\"
path= path & "Res" & document
'response.write("<br>")
'response.write(path)
ExcelBook.SaveAS path

else
missatge=Err.Description
end if

ExcelApp.Application.Quit
Set ExcelBook = Nothing
Set ExcelApp = Nothing

end sub

Lo curisoso es que lo he probado en un servidor local con los mismos componentes de office instalado y el código me funciona perfectamente. Que me estoy dejando?

ah! es windows 2000 server y office 2000

Gracias por adelantada por vuestra ayuda.

Jose
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:36.