Opening a Word Document

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
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
 
Try this:

WrdApp.NormalTemplate.Saved = True

WrdApp.Quit(SaveChanges:=Word.WdSaveOptions.wdDoNotSaveChanges)
 
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
 
Back
Top