Opening a Word Document

C

Charles A. Lackman

Hello,

I have an application that opens a word document like so:

With WrdApp
..Documents.Open(System.Windows.Forms.Application.StartupPath +
"\Template.doc", missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing)
..Selection.Paste()
..Visible = True
..Activate()
End With

This works great but when I close word the application says

This file is in use by aother application or user. (.......\Normal.dot)

When I click OK I get a "Save As" Dialog Box that wants me to save the
normal.dot

When I click CANCEL and try to exit Word the following message is displayed:

Changes have been made that affect the global template, Normal.dot. Do you
wnat to save those changes?

How do I make this stop doing this. I just want to open a document from a
..NET application.

Thanks,

Chuck
 
J

JosepM

Try this:

WrdApp.NormalTemplate.Saved = True

WrdApp.Quit(SaveChanges:=Word.WdSaveOptions.wdDoNotSaveChanges)
 
C

Charles A. Lackman

Hello,

I am using the following code to open a word docuement:

With WrdApp
..Documents.Open("C:\My Documents\MyDoc.doc", missing, missing, missing,
missing, missing, missing, missing, missing, missing, missing, missing)
..Selection.Paste()
..Visible = True
..Activate()
..NormalTemplate.Saved = True
End With

1) I have noticed that this does work with Word 2002, but it does with all
other versions. Any Ideas?

2) When the user goes to save the document it defaults to MyDoc.doc, is
there a way to change the name (programmatically) that will default to a
different name instead of MyDoc.doc.

Thanks,

Chuck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top