From: Richard on 15 Feb 2010 09:54 Hi I have created a template with some complex macros. Naturally when the template is opened, it opens as a separate WORD document & allows the macros to be run. However, once the document has been saved & closed, the macros cannot be re-run. Is there a way to retain the macros in the new document, so the macros can be run another time please? -- Richard
From: Graham Mayor on 15 Feb 2010 10:37 Instead of opening a document from the open template, open a new document from the template. File > New or in Word 2007 Office Button > New. As long as the template is available to the document the macros it contains will be available. What you appear to be doing is creating a new document, presumably based on the normal template which doesn't have your macros. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Richard" <Richard(a)discussions.microsoft.com> wrote in message news:DAB8DB46-A47E-46D7-B7A2-30E5FCB6672A(a)microsoft.com... > Hi > I have created a template with some complex macros. > > Naturally when the template is opened, it opens as a separate WORD > document > & allows the macros to be run. > > However, once the document has been saved & closed, the macros cannot be > re-run. > > Is there a way to retain the macros in the new document, so the macros can > be run another time please? > > > -- > Richard
From: Richard on 16 Feb 2010 03:03 Hi Graham Thanks for that. Your answer sounds fine for those who are 'in the know' and/or have the template on their own hard drive. I am a member of a large organisation with the templates kept in a central location & could not see how the average ignorant Joe would be able to open in the way you suggest. However, I have done some digging & most templates here are available from a button placed in a toolbar backed with code to offer a selection & open with the line of code below: WordBasic.FileNew Template:=Location Where location is the path & filename. So, you did put me on the right track, 'cos that works. Many thanks -- Richard "Graham Mayor" wrote: > Instead of opening a document from the open template, open a new document > from the template. File > New or in Word 2007 Office Button > New. > > As long as the template is available to the document the macros it contains > will be available. What you appear to be doing is creating a new document, > presumably based on the normal template which doesn't have your macros. > > -- > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > Graham Mayor - Word MVP > > My web site www.gmayor.com > Word MVP web site http://word.mvps.org > <>>< ><<> ><<> <>>< ><<> <>>< <>><<> > > > "Richard" <Richard(a)discussions.microsoft.com> wrote in message > news:DAB8DB46-A47E-46D7-B7A2-30E5FCB6672A(a)microsoft.com... > > Hi > > I have created a template with some complex macros. > > > > Naturally when the template is opened, it opens as a separate WORD > > document > > & allows the macros to be run. > > > > However, once the document has been saved & closed, the macros cannot be > > re-run. > > > > Is there a way to retain the macros in the new document, so the macros can > > be run another time please? > > > > > > -- > > Richard > > > . >
From: Graham Mayor on 16 Feb 2010 04:35 The normal intended and correct use of a document template has always been to create new documents from it. If templates are in a shared location then you can use the Workgroup folder function to make the templates more widely available. Though with Word 2007 you can make just about any location a trusted location. It should not be necessary to use WordBasic commands to create new documents. Use instead the vba command Documents.Add "d:\path\template.dot" Whether the macros will then run will depend on your security settings. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Richard" <Richard(a)discussions.microsoft.com> wrote in message news:4A45BFE8-9828-419E-B038-C96EEC93D2AC(a)microsoft.com... > Hi Graham > > Thanks for that. > > Your answer sounds fine for those who are 'in the know' and/or have the > template on their own hard drive. > > I am a member of a large organisation with the templates kept in a central > location & could not see how the average ignorant Joe would be able to > open > in the way you suggest. > > However, I have done some digging & most templates here are available from > a > button placed in a toolbar backed with code to offer a selection & open > with > the line of code below: > > WordBasic.FileNew Template:=Location > > Where location is the path & filename. > > So, you did put me on the right track, 'cos that works. > > Many thanks > -- > Richard > > > "Graham Mayor" wrote: > >> Instead of opening a document from the open template, open a new document >> from the template. File > New or in Word 2007 Office Button > New. >> >> As long as the template is available to the document the macros it >> contains >> will be available. What you appear to be doing is creating a new >> document, >> presumably based on the normal template which doesn't have your macros. >> >> -- >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> Graham Mayor - Word MVP >> >> My web site www.gmayor.com >> Word MVP web site http://word.mvps.org >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<> >> >> >> "Richard" <Richard(a)discussions.microsoft.com> wrote in message >> news:DAB8DB46-A47E-46D7-B7A2-30E5FCB6672A(a)microsoft.com... >> > Hi >> > I have created a template with some complex macros. >> > >> > Naturally when the template is opened, it opens as a separate WORD >> > document >> > & allows the macros to be run. >> > >> > However, once the document has been saved & closed, the macros cannot >> > be >> > re-run. >> > >> > Is there a way to retain the macros in the new document, so the macros >> > can >> > be run another time please? >> > >> > >> > -- >> > Richard >> >> >> . >>
|
Pages: 1 Prev: Why can't ranges be moved by wdLine? Next: How do i not print empy dropdown lists |