Another line in a macro to close a document

T

Tonya Marshall

At work I have a document in the Work menu called Frequent use.doc. There
are macro buttons to open a new document from one of the templates that we
use frequently:

Sub FaxCover()
Documents.Add "C:\<path to template>"
End Sub

Is there a way to close Frequent use.doc from the macro after a macro button
is clicked?
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Tonya,

Dim Frequent as Document, Fax as Document
Set Frequent = ActiveDocument
Set Fax = Documents.Add("C:\<path to template>")
Frequent.Close wdDoNotSaveChanges

should do it.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
T

Tonya Marshall

I think I must have done something wrong. This is the macro I have, but it
is not closing frequent.doc.

I'm experimenting at home with this. Perhaps I need to add the path to
Frequent.doc somewhere?



Sub MyEnvelope()

Documents.Add "<path to template>"

Dim Frequent As Document, MyEnvelope As Document

Set Frequent = ActiveDocument

Set MyEnvelope = Documents.Add("<path to template")

Frequent.Close wdDoNotSaveChanges

End Sub
 

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