S
sf mong
I need help regarding Office Automation through ASP.NET.
I am trying to execute a Mail
Merge Document stored on the Server.
My code is as follows :-
Dim objword As New Word.Application()
Dim objDoc As New Word.Document()
Dim strLocation As String
Dim Filename As String
Filename = "http://manoj/wordtry/temp/ct.dot"
objDoc = objword.Documents.Add(Filename)
Try
With objDoc
..Visible = True
..Documents.Open(Filename)
..ActiveDocument.MailMerge.Destination =
Word.WdMailMergeDestination.wdSendToNewDocument
..ActiveDocument.MailMerge.Execute()
End With
Catch ex As System.Exception
Response.Write("Error in Document Format" & ex.Message)
Finally
'objword.Quit()
End Try
End Sub
The same code snippet works fine on windows application
but in ASP.Net it does not work.
I get this Error
Server execution failed
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace
for more information about the error and where it
originated in the code.
Exception Details:
System.Runtime.InteropServices.COMException: Server
execution failed
Line 25: Dim objword As New Word.Application()
I am trying to execute a Mail
Merge Document stored on the Server.
My code is as follows :-
Dim objword As New Word.Application()
Dim objDoc As New Word.Document()
Dim strLocation As String
Dim Filename As String
Filename = "http://manoj/wordtry/temp/ct.dot"
objDoc = objword.Documents.Add(Filename)
Try
With objDoc
..Visible = True
..Documents.Open(Filename)
..ActiveDocument.MailMerge.Destination =
Word.WdMailMergeDestination.wdSendToNewDocument
..ActiveDocument.MailMerge.Execute()
End With
Catch ex As System.Exception
Response.Write("Error in Document Format" & ex.Message)
Finally
'objword.Quit()
End Try
End Sub
The same code snippet works fine on windows application
but in ASP.Net it does not work.
I get this Error
Server execution failed
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace
for more information about the error and where it
originated in the code.
Exception Details:
System.Runtime.InteropServices.COMException: Server
execution failed
Line 25: Dim objword As New Word.Application()