Hi,
I created a VB.Net app using VS2003. The purpose is to enter some text into the app form and then create a Word document with the text going in the document.
In developing this, I referenced the Word 11 library on my computer. And also in the code behind have
Imports Microsoft.Office.Interop
Here is part of the code - the function accepts two pieces of text and a path, and creates the doc and puts the text in it:
Dim wApp As New Word.Application
Dim cDoc As New Word.Document
Dim wrd As Word.Application
Try
wrd = New Word.Application
Catch ex As Exception
Return ex.Message
End Try
' Create a new document & range
Dim doc As Word.Document = wrd.Documents.Add()
Dim rng As Word.Range = doc.Range()
Dim para1 As Word.Paragraph
Dim para2 As Word.Paragraph
para1 = doc.Paragraphs.Add
para1.Range.Text = text1
para1.Range.InsertParagraphAfter()
para2 = doc.Paragraphs.Add
para2.Range.Text = text2
para2.Range.InsertParagraphAfter()
doc.Activate()
The word doc is then saved, etc.
This works fine for me.
In the Bin folder is the exe and also Interop.Microsoft.Office.Core.dll
I sent these two files to a friend and told him to put them in the same directory and run the app. He has the CLR because the app runs, but when he clicks the button that runs the code to create the Doc, he gets an error:
"handling error, can not find the dll or one of its components"
So my question is what needs to be done. Does the dll have to be registered? Should it be in some other folder - like the System32 folder?
Thanks,
KB
I created a VB.Net app using VS2003. The purpose is to enter some text into the app form and then create a Word document with the text going in the document.
In developing this, I referenced the Word 11 library on my computer. And also in the code behind have
Imports Microsoft.Office.Interop
Here is part of the code - the function accepts two pieces of text and a path, and creates the doc and puts the text in it:
Dim wApp As New Word.Application
Dim cDoc As New Word.Document
Dim wrd As Word.Application
Try
wrd = New Word.Application
Catch ex As Exception
Return ex.Message
End Try
' Create a new document & range
Dim doc As Word.Document = wrd.Documents.Add()
Dim rng As Word.Range = doc.Range()
Dim para1 As Word.Paragraph
Dim para2 As Word.Paragraph
para1 = doc.Paragraphs.Add
para1.Range.Text = text1
para1.Range.InsertParagraphAfter()
para2 = doc.Paragraphs.Add
para2.Range.Text = text2
para2.Range.InsertParagraphAfter()
doc.Activate()
The word doc is then saved, etc.
This works fine for me.
In the Bin folder is the exe and also Interop.Microsoft.Office.Core.dll
I sent these two files to a friend and told him to put them in the same directory and run the app. He has the CLR because the app runs, but when he clicks the button that runs the code to create the Doc, he gets an error:
"handling error, can not find the dll or one of its components"
So my question is what needs to be done. Does the dll have to be registered? Should it be in some other folder - like the System32 folder?
Thanks,
KB