From: JediKaiti on 9 Apr 2010 14:40 Forgive me if these are silly questions, but I am very new to writing macros. I have a .dotm template with an AutoNew() macro, and I am trying to figure out how to do 2 things: 1) When I have the file save, I want it to save in the same directory as the template is in, rather than in My Documents. How do I do this? 2) The macro inserts content into the document from a number of external files. Once this is done, I'd like to have it update the table of contents. How do I do that? Thank you! Kaiti
From: Doug Robbins - Word MVP on 10 Apr 2010 01:21 With ActiveDocument .TablesOfContents(1).Update .SaveAs .AttachedTemplate.Path & "\filename" End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "JediKaiti" <JediKaiti(a)discussions.microsoft.com> wrote in message news:6534606F-54B2-4D12-A7D2-1E9130067373(a)microsoft.com... > Forgive me if these are silly questions, but I am very new to writing > macros. > > I have a .dotm template with an AutoNew() macro, and I am trying to figure > out how to do 2 things: > > 1) When I have the file save, I want it to save in the same directory as > the > template is in, rather than in My Documents. How do I do this? > > 2) The macro inserts content into the document from a number of external > files. Once this is done, I'd like to have it update the table of > contents. > How do I do that? > > Thank you! > > Kaiti
From: JediKaiti on 26 Apr 2010 16:23 Thanks - that was a big help! "Doug Robbins - Word MVP" wrote: > With ActiveDocument > .TablesOfContents(1).Update > .SaveAs .AttachedTemplate.Path & "\filename" > End With > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "JediKaiti" <JediKaiti(a)discussions.microsoft.com> wrote in message > news:6534606F-54B2-4D12-A7D2-1E9130067373(a)microsoft.com... > > Forgive me if these are silly questions, but I am very new to writing > > macros. > > > > I have a .dotm template with an AutoNew() macro, and I am trying to figure > > out how to do 2 things: > > > > 1) When I have the file save, I want it to save in the same directory as > > the > > template is in, rather than in My Documents. How do I do this? > > > > 2) The macro inserts content into the document from a number of external > > files. Once this is done, I'd like to have it update the table of > > contents. > > How do I do that? > > > > Thank you! > > > > Kaiti >
|
Pages: 1 Prev: Word 2007 - How to disable Close button? Next: SpellingChecked Doesn’t Check Spelling |