Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Opening a Word Document

Reply
Thread Tools

Opening a Word Document

 
 
Charles A. Lackman
Guest
Posts: n/a
 
      04-21-2005
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


 
Reply With Quote
 
 
 
 
JosepM
Guest
Posts: n/a
 
      04-21-2005
Try this:

WrdApp.NormalTemplate.Saved = True

WrdApp.Quit(SaveChanges:=Word.WdSaveOptions.wdDoNo tSaveChanges)





"Charles A. Lackman" <(E-Mail Removed)> escribió en el mensaje
news:(E-Mail Removed)...
> Hello,
>
> I have an application that opens a word document like so:
>
> With WrdApp
> .Documents.Open(System.Windows.Forms.Application.S tartupPath +
> "\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
>
>



 
Reply With Quote
 
 
 
 
Charles A. Lackman
Guest
Posts: n/a
 
      04-25-2005
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


 
Reply With Quote
 
=?Utf-8?B?VGFyYXM=?=
Guest
Posts: n/a
 
      04-28-2005
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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not open macro storage error While opening word document =?Utf-8?B?U2l2YXJhbWFuLlM=?= ASP .Net 1 07-24-2007 11:13 AM
Opening MS WORD document from database Simon ASP .Net 2 10-28-2005 04:56 PM
Word file not opening from Adm -My recent docs but opening from file menu of Word Thaqalain Computer Support 0 06-30-2005 02:20 AM
Opening a microsoft word document from within an ASP.Net WebForm =?Utf-8?B?dGVycnk=?= ASP .Net 2 07-09-2004 12:12 PM
Opening word, excel, pp document under asp.net with VB.net code behind =?Utf-8?B?U2FpZA==?= ASP .Net 0 11-18-2003 04:01 PM



Advertisments