Insert picture in a form table

W

Wylie C

I have a table with some form and dropdown form fields in it. Of course, for
them to work properly the form must be protected. The problem and question I
have is that I also want to be able to put a picture in an unused blank cell
of the table but can't while it is protected. Can I do that and if so, how?

Thank you.
 
D

Dian D. Chapman, MVP

What you'll need to do is write a VBA sub procedure that
unlocks/relocks the form. Then between the calls to toggle the
locking...you can either add a recorded Insert > Picture procedure to
allow the user to enter the picture, or you can record on yourself and
leave the path/image as a variable (blank). You can then use an input
box or common dialog box call to allow the user to search for their
image at that point.

You might want to check out this TechTrax article which shows how to
record a macro to insert an image into letterhead. And the second one
shows how to capture information from a user. Finally, you can find
many more free forms tutorials on my site at the third URL:

Adding/Removing Stationery Logos Thru Automation
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=528

Pass Repeated Information in a Word Document
http://www.computorcompanion.com/LPMArticle.asp?ID=224

Free Word AutoForm Tutorials
http://www.mousetrax.com/techpage.html#autoforms

To get you started, here's the Protection toggle sub procedure you can
use:

Sub ToggleFormLock()
'**********************
'PURPOSE
'quickly checks form state and toggles open/close Protection
' as needed to enter data.
'**********************

'if locked, unlock, else lock
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
Else
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If

End Sub

Hope this helps...

Dian D. Chapman, Technical Consultant
Microsoft MVP, MOS Certified
Editor/TechTrax Ezine

Free MS Tutorials: http://www.mousetrax.com/techtrax
Free Word eBook: http://www.mousetrax.com/books.html
Optimize your business docs: http://www.mousetrax.com/consulting
Learn VBA the easy way: http://www.mousetrax.com/techcourses.html
 
J

Jay Freedman

I noticed several requests over the last month or so for a method of
inserting a picture into a protected form. I've prepared a sample
template with the macro code required to do it. You can download it
from http://jay-freedman.info/form_picture.zip. If you have any
questions about it, please post here or email me at the address in the
template.
 
D

Dian D. Chapman, MVP

HA...I noticed the same thing, Jay...and was working on an article,
too. ;-)

Dian ~
 
J

Jay Freedman

You're welcome to use the template if you want, or send me what you
have and I can finish the article. Happy to do it!
 
D

Dian D. Chapman, MVP

Well...since TechTrax is on hiatus, it's more of an outline for now.
But when it's time to make it more...I'll be in touch if you'd care to
share the spotlight with me so I can openly thank you for your sample
and code?

In the meantime...DON'T wait for me cos' I'm trying not to think much
about publishing right now since we're on break. So if you toss it to
MVPs.org, I'll like to it if that's cool.

We'll talk. ;-)

And thanks!

Dian ~
 
Top