Re: How to create a window showing building block organiser in 2007



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.

--
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.

On Mon, 10 Nov 2008 08:13:17 +1100, "jec" <janine0@xxxxxxxxxxxxxx> wrote:

That's interesting Doug and Greg, MVP Christian Freßdorf says that Building
Blocks cannot be previewed in a modeless userform in Word 2007.

"Doug Robbins - Word MVP" <dkr@xxxxxxxxxxxxxxxxxx> wrote in message
news:%23EybBYjQJHA.4916@xxxxxxxxxxxxxxxxxxxxxxx
You could use a UserForm, displayed as modeless, that contains a combobox,
a multiline textbox and a command button named cmbAutotext,
txtAutotextValue and cmdInsertComment respectively and have the following
code in the User Form

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" <Peter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:08B11F64-1B6E-4214-A23D-EDBB44105796@xxxxxxxxxxxxxxxx
Ideally I would like the window to be formated similiat to the autotext
entry
in Word 2003 e.g. shows the list of names of the items then a preview of
the
contents of the item. Ideally it would be a modeless window that could
float
over the application but this is not necessary. The basic context is that
I
use Word Autotext enties to insert comments into documents when making
assignments.

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



.