hi i'm trying to access word from asp.net, using
vb.net and IIS 5.1. I am just trying to instantiate a new document, but i keep getting an error. My code is as follows:
<code>
Dim objWord As Word.Application
Dim objDoc As Word.Document
objDoc.Add()
</code>
the error i get is as follows. Anyone got any ideas?:
Object variable or With block variable not set.
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.NullReferenceException: Object variable or With block variable not set.
Source Error:
Line 50: 'objDoc.Add("C:\text.doc")
Line 51: 'objDoc = New Word.Document
Line 52: objDoc.Add()
Line 53:
Line 54: End Sub
Source File: c:\inetpub\wwwroot\tripreportasp\WebApplication1\W ebForm1.aspx.
vb Line: 52
Stack Trace:
[NullReferenceException: Object variable or With block variable not set.]
Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
Microsoft.VisualBasic.CompilerServices.LateBinding .LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
WebApplication1.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\tripreportasp\WebApplication1\W ebForm1.aspx.
vb:52
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()