Hi Todd,
It isn't you that should worry about looking stupid. I overlooked the
userform aspect. (Strictly speaking, a form in a document isn't what
Microsoft calls a userform -- that term means a custom dialog box
created in the VBA editor. What you have is a "protected form" or what
Microsoft misleadingly calls an "online form".)
Unfortunately, an AutoTextList field doesn't work in a protected form.
The following works, though it's a bit clunky.
Add the logo pictures as AutoText entries in the template, with names
corresponding to the agencies/offices/etc. At the point where you want
the logo to appear in the form, insert a dropdown form field. In the
dropdown's Properties dialog, load the names of the AutoText entries
as the choices. Set the bookmark name in that dialog to "Logo"
(without the quotes).
In the VBA editor, insert this macro (see
http://www.gmayor.com/installing_macro.htm if you need instructions)
in a module within the template:
Sub exitLogo()
Dim LogoDropDown As Word.FormField
Dim ATname As String
With ActiveDocument
Set LogoDropDown = .FormFields("Logo")
ATname = LogoDropDown.DropDown.ListEntries( _
LogoDropDown.DropDown.Value).Name
If .ProtectionType <> wdNoProtection Then
.Unprotect
End If
.AttachedTemplate.AutoTextEntries(ATname).Insert _
Where:=LogoDropDown.Range, RichText:=True
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With
End Sub
Now go back to the dropdown's Properties dialog, open the "Run macro
on exit" box, and select exitLogo from the list.
Finally, protect the template and save it.
When you make a new document based on the template, you can open the
dropdown and select the desired agency name. When you tab or click out
of the dropdown, the macro will run and insert the corresponding logo
in place of the dropdown. The dropdown will no longer exist, so it
can't be changed again by this mechanism.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.