NoPrompt not working...

C

Cybert

For my new job I need to search through 25,000 short text files and
replace about 280 words with 280 NEW words.

This weekend I wrote a Word macro to accomplish this task for me.
I've been trying the code at work this morning and I've encountered
one problem: every time my macro needs to make a change it PROMPTS me
to save changes to the file.

I'm using this line to save:

Documents.Save NoPrompt:=True, _
OriginalFormat:=wdOriginalDocumentFormat

I suspect the issue is that the short text files are saved with the
extension *.gas (When my code tries to change the file I get a prompt
to save the *.gas file as *.txt.) But there must be some way to get
around this problem...

Any suggestions or ideas?
 
J

Jay Freedman

Hi Cybert,

I'm a little handicapped here by not seeing the rest of your code.
However, I'll take a guess: When you call Documents.Open, do you
assign the result to a Document object, like

MyDoc = Documents.Open(FileName)

and then use MyDoc to make changes in the text of the document? If so,
try using MyDoc.Save instead of Documents.Save.

If that doesn't help, try combining the .Save and the .Close in one
statement:

MyDoc.Close SaveChanges:=wdSaveChanges

That does work here (in Word 2003) without any prompts.
 

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

Top