TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dhavall Vadher
NA
8
14k
Create Word Document in vb.net
Jul 19 2010 5:02 AM
Hi,
I need to create a new ms word document with my
desired given name
using vb.net.
For that i have written a simple code as below
Dim wordApp As Microsoft.Office.Interop.Word.Application
Dim wordDoc As Microsoft.Office.Interop.Word.
wordApp = New Microsoft.Office.Interop.Word.Application
wordDoc = wordApp.Documents.Add
wordApp.Visible = True
This code runs perfectly, but i want to create a new document with
my given name
.
I want to give it name as "Order No. 1"
where the text "Order No." will be static and the number will be fetched from database and added +1
for that i have tried
Dim wordName as Object "Order No."
wordDoc = wordApp.Documents.Add(wordName)
but this line gives error.
COMException was unhandled
Word was unable to read this document. It may be currupt.
Try one or more of the following:
* Open and Repair the file.
Whats the error in my code, please inform me.
More i want to ask you is that i have searched in google
where every one use Word.Application, but i have to use Microsoft.Office.Interop.Word.Application
where i have imported Microsoft.Office.Interop.Word.
Give Proper Solution.
Thanks
Reply
Answers (
2
)
Events for sent email in outlook
Datatable