Opening a Word Document

Discussion in 'ASP .Net' started by Charles A. Lackman, Apr 21, 2005.

  1. 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
    Charles A. Lackman, Apr 21, 2005
    #1
    1. Advertising

  2. Charles A. Lackman

    JosepM Guest

    Try this:

    WrdApp.NormalTemplate.Saved = True

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





    "Charles A. Lackman" <> escribió en el mensaje
    news:...
    > 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
    >
    >
    JosepM, Apr 21, 2005
    #2
    1. Advertising

  3. Opening a Word Document #2

    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
    Charles A. Lackman, Apr 25, 2005
    #3
  4. RE: Opening a Word Document #2

    wdDoc.SaveAs(sRept) where sRept is the path\name you want

    "Charles A. Lackman" wrote:

    > 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
    >
    >
    >
    =?Utf-8?B?VGFyYXM=?=, Apr 28, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FpZA==?=
    Replies:
    0
    Views:
    484
    =?Utf-8?B?U2FpZA==?=
    Nov 18, 2003
  2. Stephen Witter

    opening a word doc in word not browser

    Stephen Witter, May 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    469
    Stephen Witter
    May 18, 2004
  3. =?Utf-8?B?dGVycnk=?=
    Replies:
    2
    Views:
    588
    Paul Glavich [MVP - ASP.NET]
    Jul 9, 2004
  4. =?Utf-8?B?U2l2YXJhbWFuLlM=?=

    Could not open macro storage error While opening word document

    =?Utf-8?B?U2l2YXJhbWFuLlM=?=, Feb 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,265
    sudhakar.antique
    Jul 24, 2007
  5. Simon
    Replies:
    2
    Views:
    729
    Simon
    Oct 28, 2005
Loading...

Share This Page