S
shyamprabhu
Hi All,
I have a excel file and a word file in my wwwroot directory. Now I have
developed a asp.net page which
will get input fromo user and will create a copy of that excel/word with the
given input. Then, it will open the
copied excel and try to execute the macros. while opening
the excel for macro execution, we are getting an error
as follows
HRESULT: 0x800A03EC
My code works sometime and error occurs otherway.
Please let me know how to fix this issue and make things stable.
Other details
--------------
Windows Server 2003
MS office xp 2002 sp3
..Net 2.0
VS 2005
Below is our code
--------------------
Dim oExcel As New Excel.Application()
Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
Dim oWord As New Word.Application
Dim oDocs As Word.Documents, oDoc As Word.Document
Dim report As String
Try
oDocs = oWord.Documents
oWord.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
oDocs.Open(Server.MapPath(Request.ApplicationPath) &
"\re.doc")
oDoc = oDocs.Item(1)
oDoc.SaveAs(Server.MapPath(Request.ApplicationPath) &
"\" & Request.Item("t_ibd") & ".doc")
oDoc.Close()
oExcel.Visible = False : oExcel.DisplayAlerts = False
'creating a copy of template
oBooks = oExcel.Workbooks
oBooks.Open(Server.MapPath(Request.ApplicationPath) &
"\Retreat_template.xls") 'Load colorful template with chart
oBook = oBooks.Item(1)
oBook.SaveCopyAs(Server.MapPath(Request.ApplicationPath)
& "\" & Request.Item("t_ibd") & ".xls")
oBook.Close()
'Starting the Excel macros
oBooks = oExcel.Workbooks
oBooks.Open(Server.MapPath(Request.ApplicationPath) &
"\" & Request.Item("t_ibd") & ".xls")
oBook = oBooks.Item(1)
oExcel.Run("Macro7()")
oBook.Save()
oBook.Close()
Any help would be appreciated
I have a excel file and a word file in my wwwroot directory. Now I have
developed a asp.net page which
will get input fromo user and will create a copy of that excel/word with the
given input. Then, it will open the
copied excel and try to execute the macros. while opening
the excel for macro execution, we are getting an error
as follows
HRESULT: 0x800A03EC
My code works sometime and error occurs otherway.
Please let me know how to fix this issue and make things stable.
Other details
--------------
Windows Server 2003
MS office xp 2002 sp3
..Net 2.0
VS 2005
Below is our code
--------------------
Dim oExcel As New Excel.Application()
Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
Dim oWord As New Word.Application
Dim oDocs As Word.Documents, oDoc As Word.Document
Dim report As String
Try
oDocs = oWord.Documents
oWord.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
oDocs.Open(Server.MapPath(Request.ApplicationPath) &
"\re.doc")
oDoc = oDocs.Item(1)
oDoc.SaveAs(Server.MapPath(Request.ApplicationPath) &
"\" & Request.Item("t_ibd") & ".doc")
oDoc.Close()
oExcel.Visible = False : oExcel.DisplayAlerts = False
'creating a copy of template
oBooks = oExcel.Workbooks
oBooks.Open(Server.MapPath(Request.ApplicationPath) &
"\Retreat_template.xls") 'Load colorful template with chart
oBook = oBooks.Item(1)
oBook.SaveCopyAs(Server.MapPath(Request.ApplicationPath)
& "\" & Request.Item("t_ibd") & ".xls")
oBook.Close()
'Starting the Excel macros
oBooks = oExcel.Workbooks
oBooks.Open(Server.MapPath(Request.ApplicationPath) &
"\" & Request.Item("t_ibd") & ".xls")
oBook = oBooks.Item(1)
oExcel.Run("Macro7()")
oBook.Save()
oBook.Close()
Any help would be appreciated