Associates
Tue May 13 23:57:01 PDT 2008
Thank you, Jean-Guy and Fumei for your replies.
Fumei, you're right. I actually use that code to insert the AutoText at the
selection on the userforms. All you said was exactly what's on my mind. I
know that what I'm asking is not gonna be easy one (at least to me) to carry
out. One thing i know is that they are placed or inserted in the document in
the following order. For example,
1. executive summary
2. sections
3. bibliography
4. methodology
5. glossary
So, on the userform, I have them listed in that order. Users can tick the
ones they want to have in their report. However, there might be a case where
they may change their mind later after selecting executive summary, sections,
and methodology at the start. They can come back to the userform that would
disable those that are already ticked previously (to prevent them from
deleting the autotext - which could create a similar worse headache). They
would want to have bibliography to be included in the report. I agree with
Fumei that how the word would know that here is the chunk for executive
summary, the next chunk for sections. It would be nice to have some sort of
mark attached to this chunks here to indicate here is the beginning and the
end of the chunk of executive summary.
I'm curious about how to use bookmarks as indicator.
Worse comes to worst. I was thinking if there is a way i could use to
customise the whole word application so that user can only use the ones that
are available from the toolbar. I suppose the ultimate aim of this exercise
is to set up an standard environment where users must follow when they decide
to write up a report. This way, all reports created by different users will
be consistent across the board in terms of font type, margin space, color,
correct styles and bullet formatting. This looks more professional, i think.
I'm happy to hear any other approaches that might be easier but achieve the
aim.
Thank you in advance
"fumei via OfficeKB.com" wrote:
> 1. I am willing to bet that the userforms inserts the AutoText at the
> Selection. It is the most common place. As in:
>
> NormalTemplate.AutoTextEntries("MyBlue").Insert _
> Where:=Selection.Range, _
> RichText:=True
>
> inserts an AutoText named "myBlue" at the Selection.
>
> 2. The key is that Where uses a range. Therefore, it can, in fact, be ANY
> range.
>
> NormalTemplate.AutoTextEntries("MyBlue").Insert _
> Where:=ActiveDocument.Bookmarks("whatever").Range, _
> RichText:=True
>
> inserts an AutoText named "MyBlue" at the location of the bookmark "whatever"
> (assuming there is one!).
>
> Your question appears to demand logic to determine that there IS a chunk of
> the document that WAS the AutoText "executivesummary", and there is a chunk
> of the document that WAS the AutoText "bibliography".
>
> That would be difficult. Once an Autotext is inserted. Word considers it as
> just like any other content. There is no way to determine that chunk X was
> inserted as an AutoText. Unless of course you designed something into either:
>
>
> a) the code that inserted the AutoText. Manual AutoText insertion will do
> not allow this.
>
>
> OR
>
> b) the AutoText itself.
>
> To look at b): at the end of the chunk that is defined as "executivesummary",
> you had a bookmark "ExecSummary", then inserting the AutoText would also
> insert that bookmark. Ditto "bibliography"
>
> Now, you CAN test. If ther a bookmark "executivesummary, AND there is a
> bookmark "bibliography", THEN insert a new AutoText "Sections"
>
> However...WHERE are you going to insert it????? You must state a Where.
>
> Two paragraphs after ExecutiveSummary? Four? Count the paragraphs. Just
> before Bibliography?
>
> But IF the
> Jean-Guy Marcil wrote:
> >> Hi,
> >>
> >[quoted text clipped - 14 lines]
> >> headache is whether there're some way of inserting this new autotexts
> >> somewhere between executive summary and bibliography?
> >
> >What is the specific problem?
> >
> >You already have a userform that is used to insert between 1 and 4 autotext
> >entries. Why can't you just modify it to add a 5th one?
>
> --
> Message posted via
http://www.officekb.com
>
>