Macro in form

A

Ann

I created a form for an existing paper form - a simple half page, one section
template. The idea is to fill in the fields with a picture of the original
paper form as a watermark (as a guide). Before printing onto the paper form,
the watermark must be removed. Ideally, one macro that runs on exit from the
last field would unprotect the form, remove the watermark, and reprotect the
form with the field contents intact.

So I don't know much about macros. I have (from an old posting) the macro to
unprotect and reprotect the form without erasing the field contents. I have
used it before and know it works fine. I assume I could insert lines to
remove the watermark in the middle of the existing macro.

I tried several times to create a macro that would remove the watermark
using the record feature and keyboard shortcuts. The shortcuts work fine -
the macro records fine - it debugs fine - but when you run the macro, it
doesn't work. It stops at line 3 and complains it can't find the object.

Here is what the recorder did:

ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("WordPictureWatermark1").Select
Selection.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

What do I do now? Thanks for any help!
 
D

DA

Hi Ann

If you've only got one image to get rid off, then try
something like this instead.

ActiveDocument.Sections(1). _
Headers(wdHeaderFooterPrimary).Shapes(1).Delete

Hope that helps,
Dennis
 
A

Ann

It worked like a dream. Thank you!

DA said:
Hi Ann

If you've only got one image to get rid off, then try
something like this instead.

ActiveDocument.Sections(1). _
Headers(wdHeaderFooterPrimary).Shapes(1).Delete

Hope that helps,
Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top