It works very well in Word 2003 (the autotext box allows you to easily key
through the enteries and the preview that is shown is large enough to read
the entries) but in 2007 it is not as easy to use (the names are not shown in
a list and the entries are not large enough to read). About 13 minutes into
the screeen movie at http://baker-evans.com/marker%27s-assistant/demo.html
there is a demo.
Any assistance woudl be gratefully received,
Pete Evans
Private Sub cmbAutotext_Change()
With Me.cmbAutotext
.BoundColumn = 2
Me.txtAutotextValue.Text = .Value
End With
End Sub
Private Sub cmdInsertComment_Click()
ActiveDocument.Comments.Add Range:=Selection.Range,
Text:=txtAutotextValue.Text
End Sub
Private Sub UserForm_Initialize()
For i = 1 To NormalTemplate.AutoTextEntries.Count
With NormalTemplate.AutoTextEntries(i)
Me.cmbAutotext.AddItem .Name
Me.cmbAutotext.List(Me.cmbAutotext.ListCount - 1, 1) = .Value
End With
Next i
End Sub
The Initialize statement will load the combobox with the names of the
autotext entries, when an entry is selected in the Combobox, its value will
be displayed in the textbox and clicking on the command button will insert a
comment containing the selected autotext at the location of the selection.
--
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
"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:08B11F64-1B6E-4214...@microsoft.com...
Thanks for your quick reply ... and I notice that you live just down the
range.
Unfortunately it has been soooo long since I did any VBA that it would take
a while for my fingers to create a UserForm and the various buttons and
fields. Would you have an example that you could send me to at least get me
started -- I can at least see what the code is doing. Will the text box that
displays the entries show the text be large enough to read or will it attempt
to do a page preview as the built in Building Block Organiser attempts to do.
Again, thanks for your help so far,
Peter Evans
You might be interested in
http://gregmaxey.mvps.org/Proofreader_Marks_AddIn.htm . It could easily be
adapted to include a supertip that included the text of the comment.
Supertips show when you mouse over the menu control.
While it would take considerable work to set up initially, you might also
employ a gallery control that shows actuall images of your intended comment
or marking.
See the Signature Gallery here:
http://gregmaxey.mvps.org/Ribbon_Gallery_Control.htm
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
I went ahead and added the code to include supertip text to the dropdown
controls. The supertip text is the same as the predefined comment text that
appears in the userform. One thing that I like about this method is it give
you a chance to quick edit your comment before inserting it.
Please bear in mind that Proofreader Add-In is not a commerial product and
has not be extensively tested. It is simply the child of my efforts to
provide a working example of a dynamic dropdown control in the ribbon on my
website.
--
I would suggest however that thinking about it now, the form would be easier
to use if it used a Listbox rather than a Combobox.
--
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
"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:49857ABB-F139-4C2D...@microsoft.com...
"Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org> wrote in message
news:%23EybBYj...@TK2MSFTNGP06.phx.gbl...
Christian is right that the preview from the Building Blocks Organizer isn't
available in VBA/userforms, but what Doug has written doesn't display a
"preview". It displays the text of the entry, in the font used for the multiline
text box in the userform. It won't show any formatting that's included in the
entry; and if the entry contains a graphic or a field, you'll see an asterisk or
the field code, respectively. On the plus side, if the entries are all text, the
display is guaranteed to be readable.
Greg's contribution doesn't attempt to display anything except the name of the
entry (and a tooltip with an explanatory phrase) -- no preview there, either.
Programmatic access to the Building Block preview control is something we're
discussing with Microsoft as a desirable feature for the next version, but it's
not something to count on, and definitely not available now. And if it does
become available, it'll probably be the same tiny unreadable picture you've
already said you didn't like.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
I have been toying with this issue for a few hours and another option is to
use one of the custom building block galleries. The display in the gallery
control is larger (not by much) and usually readable as compared to the full
page preview in the organizer.
I have put together a Web tips page describing how the method can be
deployed:
http://gregmaxey.mvps.org/Buiild_Employ_Custom_BB_Gallery.htm
Jay Freedman wrote:
> Hi Pete,
>
> Christian is right that the preview from the Building Blocks
> Organizer isn't available in VBA/userforms, but what Doug has written
> doesn't display a "preview". It displays the text of the entry, in
> the font used for the multiline text box in the userform. It won't
> show any formatting that's included in the entry; and if the entry
> contains a graphic or a field, you'll see an asterisk or the field
> code, respectively. On the plus side, if the entries are all text,
> the display is guaranteed to be readable.
>
> Greg's contribution doesn't attempt to display anything except the
> name of the entry (and a tooltip with an explanatory phrase) -- no
> preview there, either.
>
> Programmatic access to the Building Block preview control is
> something we're discussing with Microsoft as a desirable feature for
> the next version, but it's not something to count on, and definitely
> not available now. And if it does become available, it'll probably be
> the same tiny unreadable picture you've already said you didn't like.
>
>
--
"Greg Maxey" <gma...@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in message
news:eVhtg8sQ...@TK2MSFTNGP03.phx.gbl...
What is CC Category?
"Greg Maxey" <gma...@mIKEvICTORpAPAsIERRA.oSCARrOMEOgOLF> wrote in message
news:%23Cvkdlt...@TK2MSFTNGP04.phx.gbl...
You are right, it was not that difficult once I had some time to sit down
and look at it.
I now have the UserForm, displayed as modeless, that contains a listbox, a
multiline textbox and a command button named
cmbAutotext, txtAutotextValue and cmdInsertComment respectively and the code
you provided.
I scroll through the listbox or use the arrow keys and the text of the
highlighted autotext item is displayed in the textbox all in a modeless
UserForm.
The question is that I like the list box to automatically scroll if the user
clicks it then starts to type characters e.g. if the autotext names are fred,
jane, joan and sue then the user typed J then Jane would be highlighted and
as soon as they pressed O then joan would be highlighted.
How do I get this type of behaviour?
As you probably guessed I am new to all of this.
Peter
> How long could it really take to create 1 field, 1 combobox, and 1 command
> button? ;-)
{snipped}
0 - fmMatchEntryFirstLetter
--
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
"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:B7B64888-5BF0-4715...@microsoft.com...
And even better if I set "Match Entry" to "1 -fmMatchEntryComplete" it will
allow me to type enough letters to make the item unique and scroll to that
item.
Peter Evans
Thanks to your help so far. I can now scroll through the combolist (or type
the first couple of characters) to find the name of the autotext entry and
then click the the INSERT AS TEXT" button to insert it into the doucment or
another button to insert it as a comment. This is Good.
BUT if the autext entry contains an image the inserted item contains
something like "* EMBED Equation.DSMT4 **" and not the image. If I insert it
using INSERT > AUTOTEXT then the original with the image is inserted.
I have been using
ActiveDocument.Comments.Add Range:=Selection.Range,
_Text:=txtAutotextValue.Text
or even the following to try to get the complete value of autotext item 87
Selection.InsertAfter NormalTemplate.AutoTextEntries(87)
But all I get entered is the text of the item and not the complete item.
How can I insert the real item?
The reason that I am using my own button to insert the item is that I also
want to add other items to the comment or the text.
You insert an autotext entry like this:
NormalTemplate.AutoTextEntries(87).Insert Selection.Range, True
You CAN'T insert a drawing object in a comment. The following example
illustrates:
Sub Test()
Dim oRng As Word.Range
Dim oCom As Comment
Set oCom = ActiveDocument.Comments.Add(Range:=Selection.Range, Text:="")
NormalTemplate.AutoTextEntries("87").Insert oCom.Range, True
End Sub
And even better I have found out that while
NormalTemplate.AutoTextEntries(autoTextItemNum).Add oCom.Range, True
is not supported
NormalTemplate.AutoTextEntries(autoTextItemNum).Insert oCom.Range, True
is Ok and it allows you to insert an autotext entry containing a drawing
into a comment under VBA in the same way you can if you are using the
keyboard.
Peter