Richiamare Macro Excel da asp .net

venerdì 30 maggio 2008 - 14.26

brunello71 Profilo | Newbie

Ciao
da un applicazione asp .net devo eseguire una semplice macro excel (versione excel 2003).
In locale (cioè sulla macchina XP) la macro viene eseguita correttamente, se provo invece a lanciare l'applicazione sul server (cioè su Windows Server 2003) all'istruzione "Run" l'applicazione si blocca.
I permessi sulla macchina server sono tutti stati impostati...
non so cos'altro potrebbe causare il problema
di seguito riporto le istruzioni eseguite da codice:

Dim oXL As Object = Nothing
Dim oXLWorkbooks As Object
Dim oXLWorkbook As Object
Dim oXLSheets As Object = Nothing
Dim oXLSheet As Object = Nothing
Dim oXLRange As Object = Nothing

Try
oXL = CreateObject("Excel.Application")
oXL.DisplayAlerts = False
oXL.Visible = True

oXLWorkbooks = oXL.Workbooks
oXLWorkbook = oXLWorkbooks.Open(PathFileMacro, 0, True)

*****PUNTO IN CUI SI BLOCCA*******************
'lancia la macro
oXL.Run("Macro1")
*********************************************
Catch ex As Exception
Exit Function
Finally


System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWorkbook)
oXLWorkbook = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWorkbooks)
oXLWorkbooks = Nothing
oXL.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL)
oXL = Nothing
'chiude l'istanza di excel
CloseExcel()
GC.Collect()
GC.WaitForPendingFinalizers()
End Try


Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5