Lee
Tue Aug 10 17:38:02 CDT 2004
Our Document Management system (DMS) doesn't quite work
that way. It's not so straight forward as that. When the
DMS creates a new document based on a template, it creates
a version then edits the document so we have to have a
special command line in the Edit command of the DMS to run
the coding. If you need to edit the document again, it
runs the coding but I only want the coding to run when a
new document is generated based on the template. It's
very confusing.
The only way around the coding not running again when
someone wants to edit the document again is to have
something in the template that is deleted once the user
fills in the userform (the first time).
Never mind - I'll work it out myself as it's very
confusing due to the templates being run via a Document
Management System.
Thanks for your help anyway
>-----Original Message-----
>Hi Lee,
>
>Well, that's why I asked. If you want code to run only
when a new
>document is created based on your template, you name the
macro either
>AutoNew() in a regular module or Document_New() in the
ThisDocument
>module. Then you don't have to worry about finding and
deleting
>bookmarks.
>
>See
http://word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm for
more
>info.
>
>--
>Regards,
>Jay Freedman
http://aspnet2.com/mvp.ashx?
JayFreedman
>Microsoft Word MVP FAQ:
http://word.mvps.org
>
>"Lee" <anonymous@discussions.microsoft.com> wrote:
>
>>I want to delete the bookmark (or variable or bit of
text)
>>that it searches for... The reason being - I have MS
Word
>>2002 templates running through a document management
>>system and it runs the VBA code everytime it is opened.
I
>>do not want it to do this, I only want the coding to run
>>when a new version is created (long story so I will not
>>get into it).
>>So what I want to do is have something the VBA code can
>>look for within the document, and if found, then run the
>>userform... but once the userform has been run and the
>>user has clicked OK, I want the coding to find
>>that "something" and delete it (so when someone opens
the
>>document that is already filled in, the userform won't
>>show asking for the name, address, details of letter
etc).
>>Understand?? Kinda confusig without getting into how
our
>>document management system runs...
>>Thanks
>>
>>>-----Original Message-----
>>>"Lee" <anonymous@discussions.microsoft.com> wrote:
>>>
>>>>How do I get a template to check for a bookmark (or a
>>>>variable, or text etc) and if it is present, run a
>>>>userform? Once the userform has been filled in, I want
>>to
>>>>delete this once user has clicked OK.
>>>
>>>To check for the bookmark named "start", use the code
>>>
>>>If ActiveDocument.Bookmarks.Exists("start") Then
>>> MyUserForm.Show
>>>End If
>>>
>>>I'm not sure what you mean by "delete this" -- what
>>is "this"?
>>>
>>>--
>>>Regards,
>>>Jay Freedman
http://aspnet2.com/mvp.ashx?
>>JayFreedman
>>>Microsoft Word MVP FAQ:
http://word.mvps.org
>>>.
>>>
>
>.
>