I think you misunderstand the relation between macros, templates, and
folders. Macros apply to whatever you apply them to; they have no inherent
relation with folders unless you specify some such relation. Nor is there
any particular connection with templates, except in the sense that macros
can be stored in templates (they can also be stored in add-ins). If a macro
is stored in a template other than normal, then it is available only when
that template, or a document based on it, is open; so typically the macro
would be used for the documents based on the template. But this is a
practical issue, not a technical requirement: the macro can do anything you
like, to any documents you like, located in any folder you choose.
In the same code I posted, the macro runs on all documents in whatever
folder you specify, regardless of what templates might be attached to those
documents.
jezzica85 said:
Thanks again Jezebel,
I feel kind of silly, I just realized that I phrased my question about
this
wrong to begin with--what I meant to say was, is there a way to save a
macro
so it applies only to documents in a specific folder, and not for
everything
with the normal template?
Sorry about the confusion, and thanks for bearing with me!
Jezzica85
Jezebel said:
Dim pFileName as string
Dim pDoc as word.document
Const pFolder = "C:\.......[whatever]\"
pFileName = Dir(pFolder & "*.doc")
Do while len(pFileName) > 0
set pDoc = Documents.Open(Filename:=pFolder & pFilename)
pDoc.SaveAs FileName:=left(pDoc.FullName, len(pDoc.FullName)-3) &
".txt", FileFormat:=wdFormatDOSText
pDoc.Close
pFileName = Dir
Loop
Thank you Jezebel, but would you mind elaborating on how to apply the
macro
to all the documents in a particular folder?
Thanks!
Jezzica85
:
1. Is it possible to write an AutoClose macro so when a document
closes,
it
saves as a text file of the same name on the D drive?
Yes
2. If that macro is possible, is there a way to apply it to all the
documents in a folder without going through each one manually and
retyping
it?
Yes